[Pkg-samba-maint] r1519 - in trunk/samba/debian: . patches

bubulle at alioth.debian.org bubulle at alioth.debian.org
Sun Sep 30 12:33:48 UTC 2007


Author: bubulle
Date: 2007-09-30 12:33:47 +0000 (Sun, 30 Sep 2007)
New Revision: 1519

Added:
   trunk/samba/debian/patches/fhs-assignpaths.patch
   trunk/samba/debian/patches/fhs-filespaths.patch
   trunk/samba/debian/patches/fhs-newpaths.patch
Removed:
   trunk/samba/debian/patches/fhs.patch
Modified:
   trunk/samba/debian/changelog
   trunk/samba/debian/patches/series
Log:
Split out fhs.patch


Modified: trunk/samba/debian/changelog
===================================================================
--- trunk/samba/debian/changelog	2007-09-26 06:25:02 UTC (rev 1518)
+++ trunk/samba/debian/changelog	2007-09-30 12:33:47 UTC (rev 1519)
@@ -1,5 +1,6 @@
 samba (3.0.26a-2) UNRELEASED; urgency=low
 
+  [ Steve Langasek ]
   * fhs.patch: net usershares should also be stored under /var/lib, not under
     /var/run.  No transition handling in maintainer scripts, since this
     feature is not activated by default.
@@ -7,8 +8,15 @@
   [ Debconf translations ]
   * Hebrew added. Closes: #444054
 
- -- Steve Langasek <vorlon at debian.org>  Sun, 23 Sep 2007 14:29:29 -0700
+  [ Christian Perrier ]
+  * Split fhs.patch into 3 separate patches to make upstream integration
+    easier:
+    - fhs-newpaths.patch: introduce new paths
+    - fhs-filespaths.patch: assign files to new paths
+    - fhs-assignpaths.patch: assign paths to FHS-compatible locations
 
+ -- Christian Perrier <bubulle at debian.org>  Sun, 30 Sep 2007 14:32:27 +0200
+
 samba (3.0.26a-1) unstable; urgency=low
 
   * New upstream release.

Added: trunk/samba/debian/patches/fhs-assignpaths.patch
===================================================================
--- trunk/samba/debian/patches/fhs-assignpaths.patch	                        (rev 0)
+++ trunk/samba/debian/patches/fhs-assignpaths.patch	2007-09-30 12:33:47 UTC (rev 1519)
@@ -0,0 +1,22 @@
+Goal: Change install paths to better respect FHS. This needs fhs-newpaths.patch
+      to introduce new path variables and fhs-filespaths.patch to
+      associate files with these
+
+Fixes: #49011
+
+Status wrt upstream: Can remain Debian-specific if upstream doesn't want to
+                     change their default behaviour
+
+Index: samba-3.0.26a/source/configure.in
+===================================================================
+--- samba-3.0.26a.orig/source/configure.in
++++ samba-3.0.26a/source/configure.in
+@@ -40,7 +40,7 @@
+ [  --with-fhs              Use FHS-compliant paths (default=no)],
+ [ case "$withval" in
+   yes)
+-    lockdir="\${VARDIR}/lib/samba"
++    lockdir="\${VARDIR}/run/samba"
+     piddir="\${VARDIR}/run"
+     mandir="\${prefix}/share/man"
+     logfilebase="\${VARDIR}/log/samba"

Added: trunk/samba/debian/patches/fhs-filespaths.patch
===================================================================
--- trunk/samba/debian/patches/fhs-filespaths.patch	                        (rev 0)
+++ trunk/samba/debian/patches/fhs-filespaths.patch	2007-09-30 12:33:47 UTC (rev 1519)
@@ -0,0 +1,627 @@
+Goal: Prepare the sources to better respect FHS
+      New configurable paths are introduced in fhs-newpaths.patch
+      This patch associates files with the new paths
+
+Fixes: #49011
+
+Status wrt upstream: Mean to be forwarded upstream (a good rationale 
+                     about FHS is probably recommended)
+
+Note: Use dedicated directories for:
+      - discardable cache data (/var/cache/samba): 
+          browse.dat, printers.tbd, <printer>.tdb
+      - non discardable state data:
+          all TDB files that may need to be backed up
+      - shared data (/usr/share/samba):
+          codepage stuff
+
+      This patch needs work to be cleaner wrt people who want to run
+      multiple instances of samba
+
+      The patch *must* be reviewed after every new upstream release.
+      FAILURE TO DO SO MAY RESULT IN DATA LOSS FOR OUR USERS!
+
+      export QUILT_PATCHES=debian/patches
+      quilt push fhs.patch
+      grep -r lock_path source/ | grep -vE \
+         '"((brlock|connections|gencache|locking|messages|notify|sessionid|unexpected|wins)\.tdb|namelist.debug|lang_)|char \*lock_path|WINBINDD_PRIV_SOCKET_SUBDIR'
+
+      - This will get you the list of any new, unexpected references to
+        lock_path.  The files mentioned above are the known good uses of
+        lock_path; everything else needs to be investigated.
+      - If the file name occurs elsewhere in the fhs.patch, update the
+        patch to fix these new references to the same place (either
+        cache_path or state_path)
+      - If the file is a tdb file, and the code that opens it uses
+        TDB_CLEAR_IF_FIRST, lock_path is correct; just update the query
+        above with the new filename, no other changes are needed.
+      - Otherwise, if this is the first use of the file, you must
+        determine where the file belongs -- i.e., whether it's
+        persistent data, a cache, or runtime-only data.  Consult
+        upstream if necessary.
+      - Repeat these steps for lp_lockdir(), which is less common but
+        still used in the code.
+
+      grep -r lp_lockdir source/ | grep -vE \
+         '%s/smb_(tmp_)*krb5|source/(lib/util|param/loadparm|dynconfig|utils/testparm)\.c|WINBINDD_PRIV_SOCKET_SUBDIR|(directory_exist|mkdir)\(lp_lockdir\(\),|koplock\.%d|%s/sync\.%d'
+
+Index: samba-3.0.26a/source/intl/lang_tdb.c
+===================================================================
+--- samba-3.0.26a.orig/source/intl/lang_tdb.c
++++ samba-3.0.26a/source/intl/lang_tdb.c
+@@ -131,7 +131,7 @@
+ 	if (!lang) 
+ 		return True;
+ 
+-	asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
++	asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
+ 	if (stat(msg_path, &st) != 0) {
+ 		/* the msg file isn't available */
+ 		DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path, 
+Index: samba-3.0.26a/source/lib/util.c
+===================================================================
+--- samba-3.0.26a.orig/source/lib/util.c
++++ samba-3.0.26a/source/lib/util.c
+@@ -2632,6 +2632,61 @@
+ }
+ 
+ /**
++ * @brief Returns an absolute path to a file in the Samba data directory.
++ *
++ * @param name File to find, relative to CODEPAGEDIR.
++ *
++ * @retval Pointer to a static #pstring containing the full path.
++ **/
++
++char *data_path(const char *name)
++{
++	static pstring fname;
++	snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
++	return fname;
++}
++
++/*****************************************************************
++a useful function for returning a path in the Samba state directory
++ *****************************************************************/
++char *state_path(char *name)
++{
++	static pstring fname;
++
++	pstrcpy(fname,dyn_STATEDIR());
++	trim_string(fname,"","/");
++
++	if (!directory_exist(fname,NULL)) {
++		mkdir(fname,0755);
++	}
++
++	pstrcat(fname,"/");
++	pstrcat(fname,name);
++
++	return fname;
++}
++
++/*****************************************************************
++a useful function for returning a path in the Samba cache directory
++ *****************************************************************/
++char *cache_path(char *name)
++{
++	static pstring fname;
++
++	pstrcpy(fname,dyn_CACHEDIR());
++	trim_string(fname,"","/");
++
++	if (!directory_exist(fname,NULL)) {
++			mkdir(fname,0755);
++	}
++
++	pstrcat(fname,"/");
++	pstrcat(fname,name);
++
++	return fname;
++}
++
++/**
+  * @brief Returns the platform specific shared library extension.
+  *
+  * @retval Pointer to a static #fstring containing the extension.
+Index: samba-3.0.26a/source/lib/util_unistr.c
+===================================================================
+--- samba-3.0.26a.orig/source/lib/util_unistr.c
++++ samba-3.0.26a/source/lib/util_unistr.c
+@@ -88,11 +88,11 @@
+ 	}
+ 	initialised = 1;
+ 
+-	upcase_table = (smb_ucs2_t *)map_file(lib_path("upcase.dat"),
++	upcase_table = (smb_ucs2_t *)map_file(data_path("upcase.dat"),
+ 					      0x20000);
+ 	upcase_table_use_unmap = ( upcase_table != NULL );
+ 
+-	lowcase_table = (smb_ucs2_t *)map_file(lib_path("lowcase.dat"),
++	lowcase_table = (smb_ucs2_t *)map_file(data_path("lowcase.dat"),
+ 					       0x20000);
+ 	lowcase_table_use_unmap = ( lowcase_table != NULL );
+ 
+@@ -230,7 +230,7 @@
+ 		return;
+ 	}
+ 
+-	valid_file = (uint8 *)map_file(lib_path("valid.dat"), 0x10000);
++	valid_file = (uint8 *)map_file(data_path("valid.dat"), 0x10000);
+ 	if (valid_file) {
+ 		valid_table = valid_file;
+ 		mapped_file = 1;
+Index: samba-3.0.26a/source/libsmb/samlogon_cache.c
+===================================================================
+--- samba-3.0.26a.orig/source/libsmb/samlogon_cache.c
++++ samba-3.0.26a/source/libsmb/samlogon_cache.c
+@@ -34,7 +34,7 @@
+ BOOL netsamlogon_cache_init(void)
+ {
+ 	if (!netsamlogon_tdb) {
+-		netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
++		netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
+ 						   TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
+ 	}
+ 
+@@ -67,7 +67,7 @@
+            winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
+ 
+ 	if (!tdb) {
+-		tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 
++		tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 
+ 				   WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
+ 				   TDB_DEFAULT, O_RDWR, 0600);
+ 		if (!tdb) {
+Index: samba-3.0.26a/source/nmbd/nmbd_serverlistdb.c
+===================================================================
+--- samba-3.0.26a.orig/source/nmbd/nmbd_serverlistdb.c
++++ samba-3.0.26a/source/nmbd/nmbd_serverlistdb.c
+@@ -325,7 +325,7 @@
+ 
+ 	updatecount++;
+     
+-	pstrcpy(fname,lp_lockdir());
++	pstrcpy(fname,dyn_CACHEDIR());
+ 	trim_char(fname,'\0' ,'/');
+ 	pstrcat(fname,"/");
+ 	pstrcat(fname,SERVER_LIST);
+Index: samba-3.0.26a/source/nmbd/nmbd_winsserver.c
+===================================================================
+--- samba-3.0.26a.orig/source/nmbd/nmbd_winsserver.c
++++ samba-3.0.26a/source/nmbd/nmbd_winsserver.c
+@@ -585,7 +585,7 @@
+ 
+ 	add_samba_names_to_subnet(wins_server_subnet);
+ 
+-	if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
++	if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
+ 		DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
+ 			WINS_LIST, strerror(errno) ));
+ 		return True;
+@@ -2338,7 +2338,7 @@
+ 		}
+ 	}
+ 
+-	slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
++	slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
+ 	all_string_sub(fname,"//", "/", 0);
+ 	slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
+ 
+Index: samba-3.0.26a/source/passdb/login_cache.c
+===================================================================
+--- samba-3.0.26a.orig/source/passdb/login_cache.c
++++ samba-3.0.26a/source/passdb/login_cache.c
+@@ -36,7 +36,7 @@
+ 	/* skip file open if it's already opened */
+ 	if (cache) return True;
+ 
+-	asprintf(&cache_fname, "%s/%s", lp_lockdir(), LOGIN_CACHE_FILE);
++	asprintf(&cache_fname, "%s/%s", dyn_CACHEDIR(), LOGIN_CACHE_FILE);
+ 	if (cache_fname)
+ 		DEBUG(5, ("Opening cache file at %s\n", cache_fname));
+ 	else {
+Index: samba-3.0.26a/source/nsswitch/winbindd_cache.c
+===================================================================
+--- samba-3.0.26a.orig/source/nsswitch/winbindd_cache.c
++++ samba-3.0.26a/source/nsswitch/winbindd_cache.c
+@@ -2181,7 +2181,7 @@
+ 		return True;
+ 
+ 	/* when working offline we must not clear the cache on restart */
+-	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
++	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
+ 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
+ 				lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), 
+ 				O_RDWR|O_CREAT, 0600);
+@@ -2224,9 +2224,9 @@
+ 		tdb_close(wcache->tdb);
+ 		wcache->tdb = NULL;
+ 
+-		if (unlink(lock_path("winbindd_cache.tdb")) == -1) {
++		if (unlink(cache_path("winbindd_cache.tdb")) == -1) {
+ 			DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ",
+-				lock_path("winbindd_cache.tdb"),
++				cache_path("winbindd_cache.tdb"),
+ 				strerror(errno) ));
+ 			return False;
+ 		}
+@@ -2488,7 +2488,7 @@
+ 		return;
+ 
+ 	/* when working offline we must not clear the cache on restart */
+-	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
++	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
+ 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
+ 				lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), 
+ 				O_RDWR|O_CREAT, 0600);
+Index: samba-3.0.26a/source/param/loadparm.c
+===================================================================
+--- samba-3.0.26a.orig/source/param/loadparm.c
++++ samba-3.0.26a/source/param/loadparm.c
+@@ -108,6 +108,9 @@
+ 	char *szAddPrinterCommand;
+ 	char *szDeletePrinterCommand;
+ 	char *szOs2DriverMap;
++#ifdef FHS_COMPATIBLE
++	char *szLockDirStub;
++#endif
+ 	char *szLockDir;
+ 	char *szPidDir;
+ 	char *szRootdir;
+@@ -1200,8 +1203,13 @@
+ 	{"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
+ 	{"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}, 
+ #ifdef WITH_UTMP
+ 	{"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
+@@ -1664,7 +1672,7 @@
+ 	Globals.bASUSupport       = False;
+ 	
+ 	/* User defined shares. */
+-	pstrcpy(s, dyn_LOCKDIR);
++	pstrcpy(s, dyn_STATEDIR());
+ 	pstrcat(s, "/usershares");
+ 	string_set(&Globals.szUsersharePath, s);
+ 	string_set(&Globals.szUsershareTemplateShare, "");
+Index: samba-3.0.26a/source/passdb/secrets.c
+===================================================================
+--- samba-3.0.26a.orig/source/passdb/secrets.c
++++ samba-3.0.26a/source/passdb/secrets.c
+@@ -58,8 +58,7 @@
+ 	if (tdb)
+ 		return True;
+ 
+-	pstrcpy(fname, lp_private_dir());
+-	pstrcat(fname,"/secrets.tdb");
++	pstrcpy(fname, state_path("secrets.tdb"));
+ 
+ 	tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 
+Index: samba-3.0.26a/source/printing/nt_printing.c
+===================================================================
+--- samba-3.0.26a.orig/source/printing/nt_printing.c
++++ samba-3.0.26a/source/printing/nt_printing.c
+@@ -551,28 +551,28 @@
+  
+ 	if (tdb_drivers)
+ 		tdb_close(tdb_drivers);
+-	tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++	tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 	if (!tdb_drivers) {
+ 		DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
+-			lock_path("ntdrivers.tdb"), strerror(errno) ));
++			state_path("ntdrivers.tdb"), strerror(errno) ));
+ 		return False;
+ 	}
+  
+ 	if (tdb_printers)
+ 		tdb_close(tdb_printers);
+-	tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++	tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 	if (!tdb_printers) {
+ 		DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
+-			lock_path("ntprinters.tdb"), strerror(errno) ));
++			state_path("ntprinters.tdb"), strerror(errno) ));
+ 		return False;
+ 	}
+  
+ 	if (tdb_forms)
+ 		tdb_close(tdb_forms);
+-	tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++	tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 	if (!tdb_forms) {
+ 		DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
+-			lock_path("ntforms.tdb"), strerror(errno) ));
++			state_path("ntforms.tdb"), strerror(errno) ));
+ 		return False;
+ 	}
+  
+@@ -2359,7 +2359,7 @@
+ 	close_all_print_db();
+ 
+ 	if (geteuid() == 0) {
+-		pstrcpy(printdb_path, lock_path("printing/"));
++		pstrcpy(printdb_path, cache_path("printing/"));
+ 		pstrcat(printdb_path, sharename);
+ 		pstrcat(printdb_path, ".tdb");
+ 
+Index: samba-3.0.26a/source/printing/printing.c
+===================================================================
+--- samba-3.0.26a.orig/source/printing/printing.c
++++ samba-3.0.26a/source/printing/printing.c
+@@ -185,8 +185,8 @@
+ 	int services = lp_numservices();
+ 	int snum;
+ 
+-	unlink(lock_path("printing.tdb"));
+-	pstrcpy(printing_path,lock_path("printing"));
++	unlink(cache_path("printing.tdb"));
++	pstrcpy(printing_path,cache_path("printing"));
+ 	mkdir(printing_path,0755);
+ 
+ 	/* handle a Samba upgrade */
+Index: samba-3.0.26a/source/printing/printing_db.c
+===================================================================
+--- samba-3.0.26a.orig/source/printing/printing_db.c
++++ samba-3.0.26a/source/printing/printing_db.c
+@@ -91,7 +91,7 @@
+ 		DLIST_ADD(print_db_head, p);
+ 	}
+ 
+-	pstrcpy(printdb_path, lock_path("printing/"));
++	pstrcpy(printdb_path, cache_path("printing/"));
+ 	pstrcat(printdb_path, printername);
+ 	pstrcat(printdb_path, ".tdb");
+ 
+Index: samba-3.0.26a/source/smbd/lanman.c
+===================================================================
+--- samba-3.0.26a.orig/source/smbd/lanman.c
++++ samba-3.0.26a/source/smbd/lanman.c
+@@ -1088,9 +1088,9 @@
+ 	BOOL local_list_only;
+ 	int i;
+ 
+-	lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0);
++	lines = file_lines_load(cache_path(SERVER_LIST), NULL, 0);
+ 	if (!lines) {
+-		DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
++		DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
+ 		return 0;
+ 	}
+ 
+Index: samba-3.0.26a/source/registry/reg_db.c
+===================================================================
+--- samba-3.0.26a.orig/source/registry/reg_db.c
++++ samba-3.0.26a/source/registry/reg_db.c
+@@ -234,12 +234,12 @@
+ 	if ( tdb_reg )
+ 		return True;
+ 
+-	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
++	if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
+ 	{
+-		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++		tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 		if ( !tdb_reg ) {
+ 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
+-				lock_path("registry.tdb"), strerror(errno) ));
++				state_path("registry.tdb"), strerror(errno) ));
+ 			return False;
+ 		}
+ 		
+@@ -281,11 +281,11 @@
+ 	
+ 	become_root();
+ 
+-	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
++	tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+ 	if ( !tdb_reg ) {
+ 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
+ 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
+-			lock_path("registry.tdb"), strerror(errno) ));
++			state_path("registry.tdb"), strerror(errno) ));
+ 	}
+ 
+ 	unbecome_root();
+Index: samba-3.0.26a/source/lib/account_pol.c
+===================================================================
+--- samba-3.0.26a.orig/source/lib/account_pol.c
++++ samba-3.0.26a/source/lib/account_pol.c
+@@ -213,9 +213,9 @@
+ 		return True;
+ 	}
+ 
+-	tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
++	tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+ 	if (!tdb) { /* the account policies files does not exist or open failed, try to create a new one */
+-		tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++		tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 		if (!tdb) {
+ 			DEBUG(0,("Failed to open account policy database\n"));
+ 			return False;
+Index: samba-3.0.26a/source/registry/reg_perfcount.c
+===================================================================
+--- samba-3.0.26a.orig/source/registry/reg_perfcount.c
++++ samba-3.0.26a/source/registry/reg_perfcount.c
+@@ -46,7 +46,7 @@
+ 	
+ 	fstr_sprintf( path, "%s/%s", PERFCOUNTDIR, dbname );
+ 	
+-	pstrcpy( fname, lock_path( path ) );
++	pstrcpy( fname, state_path( path ) );
+ 	
+ 	return fname;
+ }
+@@ -56,7 +56,7 @@
+ 
+ void perfcount_init_keys( void )
+ {
+-	char *p = lock_path(PERFCOUNTDIR);
++	char *p = state_path(PERFCOUNTDIR);
+ 
+ 	/* no registry keys; just create the perfmon directory */
+ 	
+Index: samba-3.0.26a/source/rpc_server/srv_eventlog_lib.c
+===================================================================
+--- samba-3.0.26a.orig/source/rpc_server/srv_eventlog_lib.c
++++ samba-3.0.26a/source/rpc_server/srv_eventlog_lib.c
+@@ -67,7 +67,7 @@
+ {
+ 	fstring path;
+ 	char *tdb_fullpath;
+-	char *eventlogdir = lock_path( "eventlog" );
++	char *eventlogdir = state_path( "eventlog" );
+ 	
+ 	pstr_sprintf( path, "%s/%s.tdb", eventlogdir, name );
+ 	strlower_m( path );
+@@ -349,7 +349,7 @@
+ 	
+ 	/* make sure that the eventlog dir exists */
+ 	
+-	eventlogdir = lock_path( "eventlog" );
++	eventlogdir = state_path( "eventlog" );
+ 	if ( !directory_exist( eventlogdir, NULL ) )
+ 		mkdir( eventlogdir, 0755 );	
+ 	
+Index: samba-3.0.26a/source/passdb/pdb_tdb.c
+===================================================================
+--- samba-3.0.26a.orig/source/passdb/pdb_tdb.c
++++ samba-3.0.26a/source/passdb/pdb_tdb.c
+@@ -1559,7 +1559,7 @@
+ 	uint32 rid;
+ 	BOOL ret = False;
+ 
+-	tdb = tdb_open_log(lock_path("winbindd_idmap.tdb"), 0,
++	tdb = tdb_open_log(state_path("winbindd_idmap.tdb"), 0,
+ 			   TDB_DEFAULT, O_RDWR | O_CREAT, 0644);
+ 
+ 	if (tdb == NULL) {
+@@ -1623,7 +1623,7 @@
+ 	/* save the path for later */
+ 			   
+ 	if ( !location ) {
+-		pstr_sprintf( tdbfile, "%s/%s", lp_private_dir(), PASSDB_FILE_NAME );
++		pstr_sprintf( tdbfile, "%s/%s", dyn_STATEDIR(), PASSDB_FILE_NAME );
+ 		pfile = tdbfile;
+ 	}
+ 	pstrcpy( tdbsam_filename, pfile );
+Index: samba-3.0.26a/source/groupdb/mapping_tdb.c
+===================================================================
+--- samba-3.0.26a.orig/source/groupdb/mapping_tdb.c
++++ samba-3.0.26a/source/groupdb/mapping_tdb.c
+@@ -39,7 +39,7 @@
+ 	if (tdb)
+ 		return True;
+ 		
+-	tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++	tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 	if (!tdb) {
+ 		DEBUG(0,("Failed to open group mapping database\n"));
+ 		return False;
+Index: samba-3.0.26a/source/nsswitch/idmap_tdb.c
+===================================================================
+--- samba-3.0.26a.orig/source/nsswitch/idmap_tdb.c
++++ samba-3.0.26a/source/nsswitch/idmap_tdb.c
+@@ -247,7 +247,7 @@
+ 	}
+ 
+ 	/* use the old database if present */
+-	tdbfile = talloc_strdup(ctx, lock_path("winbindd_idmap.tdb"));
++	tdbfile = talloc_strdup(ctx, state_path("winbindd_idmap.tdb"));
+ 	if (!tdbfile) {
+ 		DEBUG(0, ("Out of memory!\n"));
+ 		ret = NT_STATUS_NO_MEMORY;
+Index: samba-3.0.26a/source/utils/smbcontrol.c
+===================================================================
+--- samba-3.0.26a.orig/source/utils/smbcontrol.c
++++ samba-3.0.26a/source/utils/smbcontrol.c
+@@ -832,10 +832,10 @@
+ 	/* Remove the entry in the winbindd_cache tdb to tell a later
+ 	   starting winbindd that we're online. */
+ 
+-	tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
++	tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+ 	if (!tdb) {
+ 		fprintf(stderr, "Cannot open the tdb %s for writing.\n",
+-			lock_path("winbindd_cache.tdb"));
++			cache_path("winbindd_cache.tdb"));
+ 		return False;
+ 	}
+ 
+@@ -868,13 +868,13 @@
+ 	   starting winbindd that we're offline. We may actually create
+ 	   it here... */
+ 
+-	tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
++	tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
+ 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
+ 				TDB_DEFAULT /* TDB_CLEAR_IF_FIRST */, O_RDWR|O_CREAT, 0600);
+ 
+ 	if (!tdb) {
+ 		fprintf(stderr, "Cannot open the tdb %s for writing.\n",
+-			lock_path("winbindd_cache.tdb"));
++			cache_path("winbindd_cache.tdb"));
+ 		return False;
+ 	}
+ 
+Index: samba-3.0.26a/source/lib/sharesec.c
+===================================================================
+--- samba-3.0.26a.orig/source/lib/sharesec.c
++++ samba-3.0.26a/source/lib/sharesec.c
+@@ -47,10 +47,10 @@
+ 		return True;
+ 	}
+ 
+-	share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++	share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ 	if (!share_tdb) {
+ 		DEBUG(0,("Failed to open share info database %s (%s)\n",
+-			lock_path("share_info.tdb"), strerror(errno) ));
++			state_path("share_info.tdb"), strerror(errno) ));
+ 		return False;
+ 	}
+  
+Index: samba-3.0.26a/source/libgpo/gpo_fetch.c
+===================================================================
+--- samba-3.0.26a.orig/source/libgpo/gpo_fetch.c
++++ samba-3.0.26a/source/libgpo/gpo_fetch.c
+@@ -60,7 +60,7 @@
+ 		return NT_STATUS_NO_MEMORY;
+ 	}
+ 
+-	pstrcpy(path, lock_path(GPO_CACHE_DIR));
++	pstrcpy(path, cache_path(GPO_CACHE_DIR));
+ 	pstrcat(path, "/");
+ 	pstrcat(path, file_sys_path);
+ 	pstring_sub(path, "\\", "/");
+@@ -80,7 +80,7 @@
+ 				     TALLOC_CTX *mem_ctx, 
+ 				     const char *unix_path)
+ {
+-	const char *top_dir = lock_path(GPO_CACHE_DIR);
++	const char *top_dir = cache_path(GPO_CACHE_DIR);
+ 	char *current_dir;
+ 	fstring tok;
+ 
+Index: samba-3.0.26a/source/nsswitch/idmap_cache.c
+===================================================================
+--- samba-3.0.26a.orig/source/nsswitch/idmap_cache.c
++++ samba-3.0.26a/source/nsswitch/idmap_cache.c
+@@ -55,7 +55,7 @@
+ 		return NULL;
+ 	}
+ 
+-	cache_fname = lock_path("idmap_cache.tdb");
++	cache_fname = cache_path("idmap_cache.tdb");
+ 
+ 	DEBUG(10, ("Opening cache file at %s\n", cache_fname));
+ 

Added: trunk/samba/debian/patches/fhs-newpaths.patch
===================================================================
--- trunk/samba/debian/patches/fhs-newpaths.patch	                        (rev 0)
+++ trunk/samba/debian/patches/fhs-newpaths.patch	2007-09-30 12:33:47 UTC (rev 1519)
@@ -0,0 +1,140 @@
+Goal: Prepare the sources to better respect FHS
+      This introduces new configurable paths so that fhs.patch can
+      later change the values for the newly introduced paths
+
+Fixes: #49011
+
+Status wrt upstream: Mean to be forwarded upstream (a good rationale 
+                     about FHS is probably recommended)
+
+Note: See fhs-filespaths for rationale about the meaning of the new
+      path variables
+
+Index: samba-3.0.25c/source/Makefile.in
+===================================================================
+--- samba-3.0.25c.orig/source/Makefile.in	2007-08-26 13:07:02.925532676 +0200
++++ samba-3.0.25c/source/Makefile.in	2007-08-26 13:08:59.419847863 +0200
+@@ -106,6 +106,13 @@
+ # the directory where lock files go
+ LOCKDIR = @lockdir@
+ 
++# FHS directories; equal to LOCKDIR if not using --with-fhs
++CACHEDIR = @cachedir@
++STATEDIR = @statedir@
++
++# Where to look for (and install) codepage databases.
++CODEPAGEDIR = @codepagedir@
++
+ # the directory where pid files go
+ PIDDIR = @piddir@
+ 
+@@ -139,7 +146,7 @@
+ PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\"  -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
+ PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
+ 	      -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
+-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
++PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" -DCACHEDIR=\"$(CACHEDIR)\" -DSTATEDIR=\"$(STATEDIR)\"
+ PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
+ 
+ # Note that all executable programs now provide for an optional executable suffix.
+@@ -1613,10 +1620,10 @@
+ 	@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
+ 
+ installdat: installdirs
+-	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir)
++	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir)
+ 
+ installmsg: installdirs
+-	@$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir)
++	@$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir)
+ 
+ installswat: installdirs installmsg
+ 	@$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR) $(SWATDIR) $(srcdir)
+Index: samba-3.0.25c/source/configure.in
+===================================================================
+--- samba-3.0.25c.orig/source/configure.in	2007-08-26 13:07:02.925532676 +0200
++++ samba-3.0.25c/source/configure.in	2007-08-26 13:08:59.419847863 +0200
+@@ -48,6 +48,10 @@
+     libdir="\${prefix}/lib/samba"
+     configdir="\${sysconfdir}/samba"
+     swatdir="\${DATADIR}/samba/swat"
++    codepagedir="\${prefix}/lib/samba"
++    statedir="\${VARDIR}/lib/samba"
++    cachedir="\${VARDIR}/lib/samba"
++    AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
+     ;;
+   esac])
+ 
+@@ -252,6 +256,9 @@
+ AC_SUBST(swatdir)
+ AC_SUBST(bindir)
+ AC_SUBST(sbindir)
++AC_SUBST(codepagedir)
++AC_SUBST(statedir)
++AC_SUBST(cachedir)
+ AC_SUBST(rootsbindir)
+ AC_SUBST(pammodulesdir)
+ 
+Index: samba-3.0.25c/source/dynconfig.c
+===================================================================
+--- samba-3.0.25c.orig/source/dynconfig.c	2007-08-26 13:07:02.925532676 +0200
++++ samba-3.0.25c/source/dynconfig.c	2007-08-26 13:08:59.419847863 +0200
+@@ -53,6 +53,13 @@
+ pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
+ 
+ /**
++ * @brief Samba data directory.
++ *
++ * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
++ **/
++pstring dyn_CODEPAGEDIR = CODEPAGEDIR;
++
++/**
+  * @brief Samba library directory.
+  *
+  * @sa lib_path() to get the path to a file inside the LIBDIR.
+@@ -70,3 +77,27 @@
+ 
+ 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.25c/source/include/dynconfig.h
+===================================================================
+--- samba-3.0.25c.orig/source/include/dynconfig.h	2007-08-26 13:07:02.925532676 +0200
++++ samba-3.0.25c/source/include/dynconfig.h	2007-08-26 13:08:59.419847863 +0200
+@@ -31,8 +31,12 @@
+ extern pstring dyn_CONFIGFILE;
+ extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
+ extern pstring dyn_LIBDIR;
++extern pstring dyn_CODEPAGEDIR;
+ extern fstring dyn_SHLIBEXT;
+ extern pstring dyn_LOCKDIR;
+ extern pstring dyn_PIDDIR;
+ extern pstring dyn_SMB_PASSWD_FILE;
+ extern pstring dyn_PRIVATE_DIR;
++
++char *dyn_STATEDIR(void);
++char *dyn_CACHEDIR(void);

Deleted: trunk/samba/debian/patches/fhs.patch
===================================================================
--- trunk/samba/debian/patches/fhs.patch	2007-09-26 06:25:02 UTC (rev 1518)
+++ trunk/samba/debian/patches/fhs.patch	2007-09-30 12:33:47 UTC (rev 1519)
@@ -1,761 +0,0 @@
-Goal: Better respect FHS
-
-Fixes: #49011
-
-Status wrt upstream: Should be forwarded upstream (good luck..:-))
-
-Note: Use dedicated directories for:
-      - discardable cache data (/var/cache/samba): 
-          browse.dat, printers.tbd, <printer>.tdb
-      - non discardable state data:
-          all TDB files that may need to be backed up
-      - shared data (/usr/share/samba):
-          codepage stuff
-
-      This patch needs work to be cleaner wrt people who want to run
-      multiple instances of samba
-
-      The patch *must* be reviewed after every new upstream release.
-      FAILURE TO DO SO MAY RESULT IN DATA LOSS FOR OUR USERS!
-
-      export QUILT_PATCHES=debian/patches
-      quilt push fhs.patch
-      grep -r lock_path source/ | grep -vE \
-         '"((brlock|connections|gencache|locking|messages|notify|sessionid|unexpected|wins)\.tdb|namelist.debug|lang_)|char \*lock_path|WINBINDD_PRIV_SOCKET_SUBDIR'
-
-      - This will get you the list of any new, unexpected references to
-        lock_path.  The files mentioned above are the known good uses of
-        lock_path; everything else needs to be investigated.
-      - If the file name occurs elsewhere in the fhs.patch, update the
-        patch to fix these new references to the same place (either
-        cache_path or state_path)
-      - If the file is a tdb file, and the code that opens it uses
-        TDB_CLEAR_IF_FIRST, lock_path is correct; just update the query
-        above with the new filename, no other changes are needed.
-      - Otherwise, if this is the first use of the file, you must
-        determine where the file belongs -- i.e., whether it's
-        persistent data, a cache, or runtime-only data.  Consult
-        upstream if necessary.
-      - Repeat these steps for lp_lockdir(), which is less common but
-        still used in the code.
-
-      grep -r lp_lockdir source/ | grep -vE \
-         '%s/smb_(tmp_)*krb5|source/(lib/util|param/loadparm|dynconfig|utils/testparm)\.c|WINBINDD_PRIV_SOCKET_SUBDIR|(directory_exist|mkdir)\(lp_lockdir\(\),|koplock\.%d|%s/sync\.%d'
-
-Index: samba-3.0.26a/source/Makefile.in
-===================================================================
---- samba-3.0.26a.orig/source/Makefile.in
-+++ samba-3.0.26a/source/Makefile.in
-@@ -106,6 +106,13 @@
- # the directory where lock files go
- LOCKDIR = @lockdir@
- 
-+# FHS directories; equal to LOCKDIR if not using --with-fhs
-+CACHEDIR = @cachedir@
-+STATEDIR = @statedir@
-+
-+# Where to look for (and install) codepage databases.
-+CODEPAGEDIR = @codepagedir@
-+
- # the directory where pid files go
- PIDDIR = @piddir@
- 
-@@ -139,7 +146,7 @@
- PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\"  -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
- PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
- 	      -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
--PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
-+PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" -DCACHEDIR=\"$(CACHEDIR)\" -DSTATEDIR=\"$(STATEDIR)\"
- PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
- 
- # Note that all executable programs now provide for an optional executable suffix.
-@@ -1613,10 +1620,10 @@
- 	@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
- 
- installdat: installdirs
--	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir)
-+	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir)
- 
- installmsg: installdirs
--	@$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir)
-+	@$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir)
- 
- installswat: installdirs installmsg
- 	@$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR) $(SWATDIR) $(srcdir)
-Index: samba-3.0.26a/source/configure.in
-===================================================================
---- samba-3.0.26a.orig/source/configure.in
-+++ samba-3.0.26a/source/configure.in
-@@ -40,7 +40,7 @@
- [  --with-fhs              Use FHS-compliant paths (default=no)],
- [ case "$withval" in
-   yes)
--    lockdir="\${VARDIR}/lib/samba"
-+    lockdir="\${VARDIR}/run/samba"
-     piddir="\${VARDIR}/run"
-     mandir="\${prefix}/share/man"
-     logfilebase="\${VARDIR}/log/samba"
-@@ -48,6 +48,10 @@
-     libdir="\${prefix}/lib/samba"
-     configdir="\${sysconfdir}/samba"
-     swatdir="\${DATADIR}/samba/swat"
-+    codepagedir="\${DATADIR}/samba"
-+    statedir="\${VARDIR}/lib/samba"
-+    cachedir="\${VARDIR}/cache/samba"
-+    AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
-     ;;
-   esac])
- 
-@@ -252,6 +256,9 @@
- AC_SUBST(swatdir)
- AC_SUBST(bindir)
- AC_SUBST(sbindir)
-+AC_SUBST(codepagedir)
-+AC_SUBST(statedir)
-+AC_SUBST(cachedir)
- AC_SUBST(rootsbindir)
- AC_SUBST(pammodulesdir)
- 
-Index: samba-3.0.26a/source/dynconfig.c
-===================================================================
---- samba-3.0.26a.orig/source/dynconfig.c
-+++ samba-3.0.26a/source/dynconfig.c
-@@ -53,6 +53,13 @@
- pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
- 
- /**
-+ * @brief Samba data directory.
-+ *
-+ * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
-+ **/
-+pstring dyn_CODEPAGEDIR = CODEPAGEDIR;
-+
-+/**
-  * @brief Samba library directory.
-  *
-  * @sa lib_path() to get the path to a file inside the LIBDIR.
-@@ -70,3 +77,27 @@
- 
- 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.26a/source/include/dynconfig.h
-===================================================================
---- samba-3.0.26a.orig/source/include/dynconfig.h
-+++ samba-3.0.26a/source/include/dynconfig.h
-@@ -31,8 +31,12 @@
- extern pstring dyn_CONFIGFILE;
- extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
- extern pstring dyn_LIBDIR;
-+extern pstring dyn_CODEPAGEDIR;
- extern fstring dyn_SHLIBEXT;
- extern pstring dyn_LOCKDIR;
- 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.26a/source/intl/lang_tdb.c
-===================================================================
---- samba-3.0.26a.orig/source/intl/lang_tdb.c
-+++ samba-3.0.26a/source/intl/lang_tdb.c
-@@ -131,7 +131,7 @@
- 	if (!lang) 
- 		return True;
- 
--	asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
-+	asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
- 	if (stat(msg_path, &st) != 0) {
- 		/* the msg file isn't available */
- 		DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path, 
-Index: samba-3.0.26a/source/lib/util.c
-===================================================================
---- samba-3.0.26a.orig/source/lib/util.c
-+++ samba-3.0.26a/source/lib/util.c
-@@ -2632,6 +2632,61 @@
- }
- 
- /**
-+ * @brief Returns an absolute path to a file in the Samba data directory.
-+ *
-+ * @param name File to find, relative to CODEPAGEDIR.
-+ *
-+ * @retval Pointer to a static #pstring containing the full path.
-+ **/
-+
-+char *data_path(const char *name)
-+{
-+	static pstring fname;
-+	snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
-+	return fname;
-+}
-+
-+/*****************************************************************
-+a useful function for returning a path in the Samba state directory
-+ *****************************************************************/
-+char *state_path(char *name)
-+{
-+	static pstring fname;
-+
-+	pstrcpy(fname,dyn_STATEDIR());
-+	trim_string(fname,"","/");
-+
-+	if (!directory_exist(fname,NULL)) {
-+		mkdir(fname,0755);
-+	}
-+
-+	pstrcat(fname,"/");
-+	pstrcat(fname,name);
-+
-+	return fname;
-+}
-+
-+/*****************************************************************
-+a useful function for returning a path in the Samba cache directory
-+ *****************************************************************/
-+char *cache_path(char *name)
-+{
-+	static pstring fname;
-+
-+	pstrcpy(fname,dyn_CACHEDIR());
-+	trim_string(fname,"","/");
-+
-+	if (!directory_exist(fname,NULL)) {
-+			mkdir(fname,0755);
-+	}
-+
-+	pstrcat(fname,"/");
-+	pstrcat(fname,name);
-+
-+	return fname;
-+}
-+
-+/**
-  * @brief Returns the platform specific shared library extension.
-  *
-  * @retval Pointer to a static #fstring containing the extension.
-Index: samba-3.0.26a/source/lib/util_unistr.c
-===================================================================
---- samba-3.0.26a.orig/source/lib/util_unistr.c
-+++ samba-3.0.26a/source/lib/util_unistr.c
-@@ -88,11 +88,11 @@
- 	}
- 	initialised = 1;
- 
--	upcase_table = (smb_ucs2_t *)map_file(lib_path("upcase.dat"),
-+	upcase_table = (smb_ucs2_t *)map_file(data_path("upcase.dat"),
- 					      0x20000);
- 	upcase_table_use_unmap = ( upcase_table != NULL );
- 
--	lowcase_table = (smb_ucs2_t *)map_file(lib_path("lowcase.dat"),
-+	lowcase_table = (smb_ucs2_t *)map_file(data_path("lowcase.dat"),
- 					       0x20000);
- 	lowcase_table_use_unmap = ( lowcase_table != NULL );
- 
-@@ -230,7 +230,7 @@
- 		return;
- 	}
- 
--	valid_file = (uint8 *)map_file(lib_path("valid.dat"), 0x10000);
-+	valid_file = (uint8 *)map_file(data_path("valid.dat"), 0x10000);
- 	if (valid_file) {
- 		valid_table = valid_file;
- 		mapped_file = 1;
-Index: samba-3.0.26a/source/libsmb/samlogon_cache.c
-===================================================================
---- samba-3.0.26a.orig/source/libsmb/samlogon_cache.c
-+++ samba-3.0.26a/source/libsmb/samlogon_cache.c
-@@ -34,7 +34,7 @@
- BOOL netsamlogon_cache_init(void)
- {
- 	if (!netsamlogon_tdb) {
--		netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
-+		netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
- 						   TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
- 	}
- 
-@@ -67,7 +67,7 @@
-            winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
- 
- 	if (!tdb) {
--		tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 
-+		tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 
- 				   WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
- 				   TDB_DEFAULT, O_RDWR, 0600);
- 		if (!tdb) {
-Index: samba-3.0.26a/source/nmbd/nmbd_serverlistdb.c
-===================================================================
---- samba-3.0.26a.orig/source/nmbd/nmbd_serverlistdb.c
-+++ samba-3.0.26a/source/nmbd/nmbd_serverlistdb.c
-@@ -325,7 +325,7 @@
- 
- 	updatecount++;
-     
--	pstrcpy(fname,lp_lockdir());
-+	pstrcpy(fname,dyn_CACHEDIR());
- 	trim_char(fname,'\0' ,'/');
- 	pstrcat(fname,"/");
- 	pstrcat(fname,SERVER_LIST);
-Index: samba-3.0.26a/source/nmbd/nmbd_winsserver.c
-===================================================================
---- samba-3.0.26a.orig/source/nmbd/nmbd_winsserver.c
-+++ samba-3.0.26a/source/nmbd/nmbd_winsserver.c
-@@ -585,7 +585,7 @@
- 
- 	add_samba_names_to_subnet(wins_server_subnet);
- 
--	if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
-+	if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
- 		DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
- 			WINS_LIST, strerror(errno) ));
- 		return True;
-@@ -2338,7 +2338,7 @@
- 		}
- 	}
- 
--	slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
-+	slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
- 	all_string_sub(fname,"//", "/", 0);
- 	slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
- 
-Index: samba-3.0.26a/source/passdb/login_cache.c
-===================================================================
---- samba-3.0.26a.orig/source/passdb/login_cache.c
-+++ samba-3.0.26a/source/passdb/login_cache.c
-@@ -36,7 +36,7 @@
- 	/* skip file open if it's already opened */
- 	if (cache) return True;
- 
--	asprintf(&cache_fname, "%s/%s", lp_lockdir(), LOGIN_CACHE_FILE);
-+	asprintf(&cache_fname, "%s/%s", dyn_CACHEDIR(), LOGIN_CACHE_FILE);
- 	if (cache_fname)
- 		DEBUG(5, ("Opening cache file at %s\n", cache_fname));
- 	else {
-Index: samba-3.0.26a/source/nsswitch/winbindd_cache.c
-===================================================================
---- samba-3.0.26a.orig/source/nsswitch/winbindd_cache.c
-+++ samba-3.0.26a/source/nsswitch/winbindd_cache.c
-@@ -2181,7 +2181,7 @@
- 		return True;
- 
- 	/* when working offline we must not clear the cache on restart */
--	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
-+	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
- 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
- 				lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), 
- 				O_RDWR|O_CREAT, 0600);
-@@ -2224,9 +2224,9 @@
- 		tdb_close(wcache->tdb);
- 		wcache->tdb = NULL;
- 
--		if (unlink(lock_path("winbindd_cache.tdb")) == -1) {
-+		if (unlink(cache_path("winbindd_cache.tdb")) == -1) {
- 			DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ",
--				lock_path("winbindd_cache.tdb"),
-+				cache_path("winbindd_cache.tdb"),
- 				strerror(errno) ));
- 			return False;
- 		}
-@@ -2488,7 +2488,7 @@
- 		return;
- 
- 	/* when working offline we must not clear the cache on restart */
--	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
-+	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
- 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
- 				lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), 
- 				O_RDWR|O_CREAT, 0600);
-Index: samba-3.0.26a/source/param/loadparm.c
-===================================================================
---- samba-3.0.26a.orig/source/param/loadparm.c
-+++ samba-3.0.26a/source/param/loadparm.c
-@@ -108,6 +108,9 @@
- 	char *szAddPrinterCommand;
- 	char *szDeletePrinterCommand;
- 	char *szOs2DriverMap;
-+#ifdef FHS_COMPATIBLE
-+	char *szLockDirStub;
-+#endif
- 	char *szLockDir;
- 	char *szPidDir;
- 	char *szRootdir;
-@@ -1200,8 +1203,13 @@
- 	{"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
- 	{"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}, 
- #ifdef WITH_UTMP
- 	{"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
-@@ -1664,7 +1672,7 @@
- 	Globals.bASUSupport       = False;
- 	
- 	/* User defined shares. */
--	pstrcpy(s, dyn_LOCKDIR);
-+	pstrcpy(s, dyn_STATEDIR());
- 	pstrcat(s, "/usershares");
- 	string_set(&Globals.szUsersharePath, s);
- 	string_set(&Globals.szUsershareTemplateShare, "");
-Index: samba-3.0.26a/source/passdb/secrets.c
-===================================================================
---- samba-3.0.26a.orig/source/passdb/secrets.c
-+++ samba-3.0.26a/source/passdb/secrets.c
-@@ -58,8 +58,7 @@
- 	if (tdb)
- 		return True;
- 
--	pstrcpy(fname, lp_private_dir());
--	pstrcat(fname,"/secrets.tdb");
-+	pstrcpy(fname, state_path("secrets.tdb"));
- 
- 	tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 
-Index: samba-3.0.26a/source/printing/nt_printing.c
-===================================================================
---- samba-3.0.26a.orig/source/printing/nt_printing.c
-+++ samba-3.0.26a/source/printing/nt_printing.c
-@@ -551,28 +551,28 @@
-  
- 	if (tdb_drivers)
- 		tdb_close(tdb_drivers);
--	tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+	tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 	if (!tdb_drivers) {
- 		DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
--			lock_path("ntdrivers.tdb"), strerror(errno) ));
-+			state_path("ntdrivers.tdb"), strerror(errno) ));
- 		return False;
- 	}
-  
- 	if (tdb_printers)
- 		tdb_close(tdb_printers);
--	tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+	tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 	if (!tdb_printers) {
- 		DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
--			lock_path("ntprinters.tdb"), strerror(errno) ));
-+			state_path("ntprinters.tdb"), strerror(errno) ));
- 		return False;
- 	}
-  
- 	if (tdb_forms)
- 		tdb_close(tdb_forms);
--	tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+	tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 	if (!tdb_forms) {
- 		DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
--			lock_path("ntforms.tdb"), strerror(errno) ));
-+			state_path("ntforms.tdb"), strerror(errno) ));
- 		return False;
- 	}
-  
-@@ -2359,7 +2359,7 @@
- 	close_all_print_db();
- 
- 	if (geteuid() == 0) {
--		pstrcpy(printdb_path, lock_path("printing/"));
-+		pstrcpy(printdb_path, cache_path("printing/"));
- 		pstrcat(printdb_path, sharename);
- 		pstrcat(printdb_path, ".tdb");
- 
-Index: samba-3.0.26a/source/printing/printing.c
-===================================================================
---- samba-3.0.26a.orig/source/printing/printing.c
-+++ samba-3.0.26a/source/printing/printing.c
-@@ -185,8 +185,8 @@
- 	int services = lp_numservices();
- 	int snum;
- 
--	unlink(lock_path("printing.tdb"));
--	pstrcpy(printing_path,lock_path("printing"));
-+	unlink(cache_path("printing.tdb"));
-+	pstrcpy(printing_path,cache_path("printing"));
- 	mkdir(printing_path,0755);
- 
- 	/* handle a Samba upgrade */
-Index: samba-3.0.26a/source/printing/printing_db.c
-===================================================================
---- samba-3.0.26a.orig/source/printing/printing_db.c
-+++ samba-3.0.26a/source/printing/printing_db.c
-@@ -91,7 +91,7 @@
- 		DLIST_ADD(print_db_head, p);
- 	}
- 
--	pstrcpy(printdb_path, lock_path("printing/"));
-+	pstrcpy(printdb_path, cache_path("printing/"));
- 	pstrcat(printdb_path, printername);
- 	pstrcat(printdb_path, ".tdb");
- 
-Index: samba-3.0.26a/source/smbd/lanman.c
-===================================================================
---- samba-3.0.26a.orig/source/smbd/lanman.c
-+++ samba-3.0.26a/source/smbd/lanman.c
-@@ -1088,9 +1088,9 @@
- 	BOOL local_list_only;
- 	int i;
- 
--	lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0);
-+	lines = file_lines_load(cache_path(SERVER_LIST), NULL, 0);
- 	if (!lines) {
--		DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
-+		DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
- 		return 0;
- 	}
- 
-Index: samba-3.0.26a/source/registry/reg_db.c
-===================================================================
---- samba-3.0.26a.orig/source/registry/reg_db.c
-+++ samba-3.0.26a/source/registry/reg_db.c
-@@ -234,12 +234,12 @@
- 	if ( tdb_reg )
- 		return True;
- 
--	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
-+	if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
- 	{
--		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+		tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 		if ( !tdb_reg ) {
- 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
--				lock_path("registry.tdb"), strerror(errno) ));
-+				state_path("registry.tdb"), strerror(errno) ));
- 			return False;
- 		}
- 		
-@@ -281,11 +281,11 @@
- 	
- 	become_root();
- 
--	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
-+	tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
- 	if ( !tdb_reg ) {
- 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
- 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
--			lock_path("registry.tdb"), strerror(errno) ));
-+			state_path("registry.tdb"), strerror(errno) ));
- 	}
- 
- 	unbecome_root();
-Index: samba-3.0.26a/source/lib/account_pol.c
-===================================================================
---- samba-3.0.26a.orig/source/lib/account_pol.c
-+++ samba-3.0.26a/source/lib/account_pol.c
-@@ -213,9 +213,9 @@
- 		return True;
- 	}
- 
--	tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
-+	tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
- 	if (!tdb) { /* the account policies files does not exist or open failed, try to create a new one */
--		tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+		tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 		if (!tdb) {
- 			DEBUG(0,("Failed to open account policy database\n"));
- 			return False;
-Index: samba-3.0.26a/source/registry/reg_perfcount.c
-===================================================================
---- samba-3.0.26a.orig/source/registry/reg_perfcount.c
-+++ samba-3.0.26a/source/registry/reg_perfcount.c
-@@ -46,7 +46,7 @@
- 	
- 	fstr_sprintf( path, "%s/%s", PERFCOUNTDIR, dbname );
- 	
--	pstrcpy( fname, lock_path( path ) );
-+	pstrcpy( fname, state_path( path ) );
- 	
- 	return fname;
- }
-@@ -56,7 +56,7 @@
- 
- void perfcount_init_keys( void )
- {
--	char *p = lock_path(PERFCOUNTDIR);
-+	char *p = state_path(PERFCOUNTDIR);
- 
- 	/* no registry keys; just create the perfmon directory */
- 	
-Index: samba-3.0.26a/source/rpc_server/srv_eventlog_lib.c
-===================================================================
---- samba-3.0.26a.orig/source/rpc_server/srv_eventlog_lib.c
-+++ samba-3.0.26a/source/rpc_server/srv_eventlog_lib.c
-@@ -67,7 +67,7 @@
- {
- 	fstring path;
- 	char *tdb_fullpath;
--	char *eventlogdir = lock_path( "eventlog" );
-+	char *eventlogdir = state_path( "eventlog" );
- 	
- 	pstr_sprintf( path, "%s/%s.tdb", eventlogdir, name );
- 	strlower_m( path );
-@@ -349,7 +349,7 @@
- 	
- 	/* make sure that the eventlog dir exists */
- 	
--	eventlogdir = lock_path( "eventlog" );
-+	eventlogdir = state_path( "eventlog" );
- 	if ( !directory_exist( eventlogdir, NULL ) )
- 		mkdir( eventlogdir, 0755 );	
- 	
-Index: samba-3.0.26a/source/passdb/pdb_tdb.c
-===================================================================
---- samba-3.0.26a.orig/source/passdb/pdb_tdb.c
-+++ samba-3.0.26a/source/passdb/pdb_tdb.c
-@@ -1559,7 +1559,7 @@
- 	uint32 rid;
- 	BOOL ret = False;
- 
--	tdb = tdb_open_log(lock_path("winbindd_idmap.tdb"), 0,
-+	tdb = tdb_open_log(state_path("winbindd_idmap.tdb"), 0,
- 			   TDB_DEFAULT, O_RDWR | O_CREAT, 0644);
- 
- 	if (tdb == NULL) {
-@@ -1623,7 +1623,7 @@
- 	/* save the path for later */
- 			   
- 	if ( !location ) {
--		pstr_sprintf( tdbfile, "%s/%s", lp_private_dir(), PASSDB_FILE_NAME );
-+		pstr_sprintf( tdbfile, "%s/%s", dyn_STATEDIR(), PASSDB_FILE_NAME );
- 		pfile = tdbfile;
- 	}
- 	pstrcpy( tdbsam_filename, pfile );
-Index: samba-3.0.26a/source/groupdb/mapping_tdb.c
-===================================================================
---- samba-3.0.26a.orig/source/groupdb/mapping_tdb.c
-+++ samba-3.0.26a/source/groupdb/mapping_tdb.c
-@@ -39,7 +39,7 @@
- 	if (tdb)
- 		return True;
- 		
--	tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+	tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 	if (!tdb) {
- 		DEBUG(0,("Failed to open group mapping database\n"));
- 		return False;
-Index: samba-3.0.26a/source/nsswitch/idmap_tdb.c
-===================================================================
---- samba-3.0.26a.orig/source/nsswitch/idmap_tdb.c
-+++ samba-3.0.26a/source/nsswitch/idmap_tdb.c
-@@ -247,7 +247,7 @@
- 	}
- 
- 	/* use the old database if present */
--	tdbfile = talloc_strdup(ctx, lock_path("winbindd_idmap.tdb"));
-+	tdbfile = talloc_strdup(ctx, state_path("winbindd_idmap.tdb"));
- 	if (!tdbfile) {
- 		DEBUG(0, ("Out of memory!\n"));
- 		ret = NT_STATUS_NO_MEMORY;
-Index: samba-3.0.26a/source/utils/smbcontrol.c
-===================================================================
---- samba-3.0.26a.orig/source/utils/smbcontrol.c
-+++ samba-3.0.26a/source/utils/smbcontrol.c
-@@ -832,10 +832,10 @@
- 	/* Remove the entry in the winbindd_cache tdb to tell a later
- 	   starting winbindd that we're online. */
- 
--	tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
-+	tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
- 	if (!tdb) {
- 		fprintf(stderr, "Cannot open the tdb %s for writing.\n",
--			lock_path("winbindd_cache.tdb"));
-+			cache_path("winbindd_cache.tdb"));
- 		return False;
- 	}
- 
-@@ -868,13 +868,13 @@
- 	   starting winbindd that we're offline. We may actually create
- 	   it here... */
- 
--	tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
-+	tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
- 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
- 				TDB_DEFAULT /* TDB_CLEAR_IF_FIRST */, O_RDWR|O_CREAT, 0600);
- 
- 	if (!tdb) {
- 		fprintf(stderr, "Cannot open the tdb %s for writing.\n",
--			lock_path("winbindd_cache.tdb"));
-+			cache_path("winbindd_cache.tdb"));
- 		return False;
- 	}
- 
-Index: samba-3.0.26a/source/lib/sharesec.c
-===================================================================
---- samba-3.0.26a.orig/source/lib/sharesec.c
-+++ samba-3.0.26a/source/lib/sharesec.c
-@@ -47,10 +47,10 @@
- 		return True;
- 	}
- 
--	share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
-+	share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
- 	if (!share_tdb) {
- 		DEBUG(0,("Failed to open share info database %s (%s)\n",
--			lock_path("share_info.tdb"), strerror(errno) ));
-+			state_path("share_info.tdb"), strerror(errno) ));
- 		return False;
- 	}
-  
-Index: samba-3.0.26a/source/libgpo/gpo_fetch.c
-===================================================================
---- samba-3.0.26a.orig/source/libgpo/gpo_fetch.c
-+++ samba-3.0.26a/source/libgpo/gpo_fetch.c
-@@ -60,7 +60,7 @@
- 		return NT_STATUS_NO_MEMORY;
- 	}
- 
--	pstrcpy(path, lock_path(GPO_CACHE_DIR));
-+	pstrcpy(path, cache_path(GPO_CACHE_DIR));
- 	pstrcat(path, "/");
- 	pstrcat(path, file_sys_path);
- 	pstring_sub(path, "\\", "/");
-@@ -80,7 +80,7 @@
- 				     TALLOC_CTX *mem_ctx, 
- 				     const char *unix_path)
- {
--	const char *top_dir = lock_path(GPO_CACHE_DIR);
-+	const char *top_dir = cache_path(GPO_CACHE_DIR);
- 	char *current_dir;
- 	fstring tok;
- 
-Index: samba-3.0.26a/source/nsswitch/idmap_cache.c
-===================================================================
---- samba-3.0.26a.orig/source/nsswitch/idmap_cache.c
-+++ samba-3.0.26a/source/nsswitch/idmap_cache.c
-@@ -55,7 +55,7 @@
- 		return NULL;
- 	}
- 
--	cache_fname = lock_path("idmap_cache.tdb");
-+	cache_fname = cache_path("idmap_cache.tdb");
- 
- 	DEBUG(10, ("Opening cache file at %s\n", cache_fname));
- 

Modified: trunk/samba/debian/patches/series
===================================================================
--- trunk/samba/debian/patches/series	2007-09-26 06:25:02 UTC (rev 1518)
+++ trunk/samba/debian/patches/series	2007-09-30 12:33:47 UTC (rev 1519)
@@ -1,6 +1,8 @@
 cups.patch
 documentation.patch
-fhs.patch
+fhs-newpaths.patch
+fhs-filespaths.patch
+fhs-assignpaths.patch
 installswat.sh.patch
 make-distclean.patch
 non-linux-ports.patch




More information about the Pkg-samba-maint mailing list