Hello:

  Find attached an updated z-fix-fhs patch for 3.0.24 (current) version.

  I noticed that the line 38 of the rules file "--libdir=/etc/samba" doesn't 
make much sense, I think "--libdir=/usr/lib/samba" would be more meaningful, 
but yet I managed to build the package without that line, because in the end 
it is replaced somehow by the samba build system.

  With this patch it is possible to compile samba in order to run 
several instances since you can define the path of all the data samba needs, 
this includes:pid, lock, cache, state directories and also private dir.

  This patch should be applied after all the rest of patches, I also attach 
the series file.

  I think the next step is now merging fhs.patch and this patch into one 
single patch and send it upstream. I think they will accept this patch since 
someone at #samba-technical suggested me sending a rationale to the 
samba-internal mailing list after seeing some kind of acceptance about the 
idea.

  Finally, I got this build and tested it. You need to make sure that the new 
parameters in the config file are different to the defined in an already 
running instance of samba because I don't think samba will work if you mess 
temporary data files.

  If you have some comments please, let me know.

-- 
Raúl Sánchez Siles
Barracuda Systems S.L.
C/ Luxemburgo, 4 - Local
Pozuelo de Alarcón
28224 Madrid
Tlf.: +34 91 351 11 20
Fax: +34 91 352 54 44
Index: samba-3.0.24/source/Makefile.in
===================================================================
--- samba-3.0.24.orig/source/Makefile.in	2007-02-19 13:45:58.000000000 +0100
+++ samba-3.0.24/source/Makefile.in	2007-02-19 13:45:58.000000000 +0100
@@ -1445,7 +1445,7 @@
 # is not used
 
 installdirs:
-	@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR)
+	@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR) $(CACHEDIR) $(STATEDIR)
 
 installservers: all installdirs
 	@$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(SBINDIR) $(SBIN_PROGS)
@@ -1559,6 +1559,8 @@
 	@echo "  privatedir:  $(PRIVATE_DIR)"
 	@echo "  configdir:   $(CONFIGDIR)"
 	@echo "  lockdir:     $(LOCKDIR)"
+	@echo "  cachedir:    $(CACHEDIR)"
+	@echo "  statedir:    $(STATEDIR)"
 	@echo "  piddir:      $(PIDDIR)"
 	@echo "  swatdir:     $(SWATDIR)"
 
Index: samba-3.0.24/source/dynconfig.c
===================================================================
--- samba-3.0.24.orig/source/dynconfig.c	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/dynconfig.c	2007-02-19 13:45:58.000000000 +0100
@@ -73,31 +73,10 @@
  * Not writable, but used to set a default in the parameter table.
  **/
 pstring dyn_LOCKDIR = LOCKDIR;
+pstring dyn_STATEDIR = STATEDIR;
+pstring dyn_CACHEDIR = CACHEDIR;
 pstring dyn_PIDDIR  = PIDDIR;
 
 pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
 pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
 
-
-/* In non-FHS mode, these should be configurable using 'lock dir =';
-   but in FHS mode, they are their own directory.  Implement as wrapper
-   functions so that everything can still be kept in dynconfig.c.
- */
-
-char *dyn_STATEDIR(void)
-{
-#ifdef FHS_COMPATIBLE
-	return STATEDIR;
-#else
-	return lp_lockdir();
-#endif
-}
-
-char *dyn_CACHEDIR(void)
-{
-#ifdef FHS_COMPATIBLE
-	return CACHEDIR;
-#else
-	return lp_lockdir();
-#endif
-}
Index: samba-3.0.24/source/include/dynconfig.h
===================================================================
--- samba-3.0.24.orig/source/include/dynconfig.h	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/include/dynconfig.h	2007-02-19 13:45:58.000000000 +0100
@@ -34,9 +34,8 @@
 extern pstring dyn_CODEPAGEDIR;
 extern fstring dyn_SHLIBEXT;
 extern pstring dyn_LOCKDIR;
+extern pstring dyn_CACHEDIR;
+extern pstring dyn_STATEDIR;
 extern pstring dyn_PIDDIR;
 extern pstring dyn_SMB_PASSWD_FILE;
 extern pstring dyn_PRIVATE_DIR;
-
-char *dyn_STATEDIR(void);
-char *dyn_CACHEDIR(void);
Index: samba-3.0.24/source/lib/util.c
===================================================================
--- samba-3.0.24.orig/source/lib/util.c	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/lib/util.c	2007-02-19 13:45:58.000000000 +0100
@@ -2595,7 +2595,7 @@
 {
 	static pstring fname;
 
-	pstrcpy(fname,dyn_STATEDIR());
+	pstrcpy(fname,lp_statedir());
 	trim_string(fname,"","/");
 
 	if (!directory_exist(fname,NULL)) {
@@ -2615,7 +2615,7 @@
 {
 	static pstring fname;
 
-	pstrcpy(fname,dyn_CACHEDIR());
+	pstrcpy(fname,lp_cachedir());
 	trim_string(fname,"","/");
 
 	if (!directory_exist(fname,NULL)) {
Index: samba-3.0.24/source/nmbd/nmbd_serverlistdb.c
===================================================================
--- samba-3.0.24.orig/source/nmbd/nmbd_serverlistdb.c	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/nmbd/nmbd_serverlistdb.c	2007-02-19 13:45:58.000000000 +0100
@@ -325,7 +325,7 @@
 
 	updatecount++;
     
-	pstrcpy(fname,dyn_CACHEDIR());
+	pstrcpy(fname,lp_cachedir());
 	trim_char(fname,'\0' ,'/');
 	pstrcat(fname,"/");
 	pstrcat(fname,SERVER_LIST);
Index: samba-3.0.24/source/nmbd/nmbd_winsserver.c
===================================================================
--- samba-3.0.24.orig/source/nmbd/nmbd_winsserver.c	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/nmbd/nmbd_winsserver.c	2007-02-19 13:45:58.000000000 +0100
@@ -2337,7 +2337,7 @@
 		}
 	}
 
-	slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
+	slprintf(fname,sizeof(fname)-1,"%s/%s", lp_statedir(), WINS_LIST);
 	all_string_sub(fname,"//", "/", 0);
 	slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
 
Index: samba-3.0.24/source/param/loadparm.c
===================================================================
--- samba-3.0.24.orig/source/param/loadparm.c	2007-02-19 13:45:57.000000000 +0100
+++ samba-3.0.24/source/param/loadparm.c	2007-02-19 13:45:58.000000000 +0100
@@ -107,10 +107,9 @@
 	char *szAddPrinterCommand;
 	char *szDeletePrinterCommand;
 	char *szOs2DriverMap;
-#ifdef FHS_COMPATIBLE
-	char *szLockDirStub;
-#endif
 	char *szLockDir;
+	char *szCacheDir;
+	char *szStateDir;
 	char *szPidDir;
 	char *szRootdir;
 	char *szDefaultService;
@@ -1188,19 +1187,18 @@
 	
 	{"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, 
 	{"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
-	{"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
-#ifdef FHS_COMPATIBLE
-	{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0}, 
-	{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
-#else
+	{"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
 	{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED}, 
-	{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE}, 
-#endif
-	{"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED}, 
+	{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE},
+	{"cache directory", P_STRING, P_GLOBAL, &Globals.szCacheDir, NULL, NULL, FLAG_ADVANCED},
+	{"cache dir", P_STRING, P_GLOBAL, &Globals.szCacheDir, NULL, NULL, FLAG_HIDE},
+	{"state directory", P_STRING, P_GLOBAL, &Globals.szStateDir, NULL, NULL, FLAG_ADVANCED},
+	{"state dir", P_STRING, P_GLOBAL, &Globals.szStateDir, NULL, NULL, FLAG_HIDE},
+	{"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED},
 #ifdef WITH_UTMP
-	{"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
-	{"wtmp directory", P_STRING, P_GLOBAL, &Globals.szWtmpDir, NULL, NULL, FLAG_ADVANCED}, 
-	{"utmp", P_BOOL, P_GLOBAL, &Globals.bUtmp, NULL, NULL, FLAG_ADVANCED}, 
+	{"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED},
+	{"wtmp directory", P_STRING, P_GLOBAL, &Globals.szWtmpDir, NULL, NULL, FLAG_ADVANCED},
+	{"utmp", P_BOOL, P_GLOBAL, &Globals.bUtmp, NULL, NULL, FLAG_ADVANCED},
 #endif
 
 	{"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_ADVANCED}, 
@@ -1454,6 +1452,8 @@
 	string_set(&Globals.szPasswdProgram, "");
 	string_set(&Globals.szPidDir, dyn_PIDDIR);
 	string_set(&Globals.szLockDir, dyn_LOCKDIR);
+	string_set(&Globals.szCacheDir, dyn_CACHEDIR);
+	string_set(&Globals.szStateDir, dyn_STATEDIR);
 	string_set(&Globals.szSocketAddress, "0.0.0.0");
 	pstrcpy(s, "Samba ");
 	pstrcat(s, SAMBA_VERSION_STRING);
@@ -1770,6 +1770,8 @@
 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
+FN_GLOBAL_STRING(lp_cachedir, &Globals.szCacheDir)
+FN_GLOBAL_STRING(lp_statedir, &Globals.szStateDir)
 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
Index: samba-3.0.24/source/script/mkbuildoptions.awk
===================================================================
--- samba-3.0.24.orig/source/script/mkbuildoptions.awk	2007-02-19 13:45:30.000000000 +0100
+++ samba-3.0.24/source/script/mkbuildoptions.awk	2007-02-19 13:45:58.000000000 +0100
@@ -87,6 +87,8 @@
 	print "       output(screen,\"   SHLIBEXT: %s\\n\",dyn_SHLIBEXT);";
 
 	print "       output(screen,\"   LOCKDIR: %s\\n\",dyn_LOCKDIR);";
+	print "       output(screen,\"   CACHEDIR: %s\\n\",dyn_CACHEDIR);";
+	print "       output(screen,\"   STATEDIR: %s\\n\",dyn_STATEDIR);";
 	print "       output(screen,\"   PIDDIR: %s\\n\", dyn_PIDDIR);";
 
 	print "       output(screen,\"   SMB_PASSWD_FILE: %s\\n\",dyn_SMB_PASSWD_FILE);";
Index: samba-3.0.24/source/passdb/login_cache.c
===================================================================
--- samba-3.0.24.orig/source/passdb/login_cache.c	2007-02-19 14:16:52.000000000 +0100
+++ samba-3.0.24/source/passdb/login_cache.c	2007-02-19 14:17:15.000000000 +0100
@@ -36,7 +36,7 @@
 	/* skip file open if it's already opened */
 	if (cache) return True;
 
-	asprintf(&cache_fname, "%s/%s", dyn_CACHEDIR(), LOGIN_CACHE_FILE);
+	asprintf(&cache_fname, "%s/%s", lp_cachedir(), LOGIN_CACHE_FILE);
 	if (cache_fname)
 		DEBUG(5, ("Opening cache file at %s\n", cache_fname));
 	else {
Index: samba-3.0.24/source/passdb/pdb_tdb.c
===================================================================
--- samba-3.0.24.orig/source/passdb/pdb_tdb.c	2007-02-19 14:18:24.000000000 +0100
+++ samba-3.0.24/source/passdb/pdb_tdb.c	2007-02-19 14:18:50.000000000 +0100
@@ -1612,7 +1612,7 @@
 	/* save the path for later */
 			   
 	if ( !location ) {
-		pstr_sprintf( tdbfile, "%s/%s", dyn_STATEDIR(), PASSDB_FILE_NAME );
+		pstr_sprintf( tdbfile, "%s/%s", lp_statedir(), PASSDB_FILE_NAME );
 		pfile = tdbfile;
 	}
 	pstrcpy( tdbsam_filename, pfile );
cups.patch
documentation.patch
fhs.patch
installswat.sh.patch
make-distclean.patch
nmbd-signalling.patch
non-linux-ports.patch
nonpic-libsmbclient.patch
pam-examples.patch
README_nosmbldap-tools.patch
samba.patch
smbclient-pager.patch
smbmount-mtab-flags.patch
smbmount-nomtab.patch
smbmount-unix-caps.patch
smbstatus-locking.patch
undefined-symbols.patch
VERSION.patch
adapt_machine_creation_script.patch
autoconf.patch
python-examples.patch
no_unbreakable_spaces_in_man.patch
z-fix-fhs.patch

Attachment: pgp02d7I1OsGS.pgp
Description: PGP signature

Reply via email to