• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/samba-3.0.25b/packaging/Debian/debian-sarge/patches/
1diff -uNr samba-3.0.10.orig/source/Makefile.in samba-3.0.10/source/Makefile.in
2--- samba-3.0.10.orig/source/Makefile.in	2004-12-17 03:50:08.000000000 -0800
3+++ samba-3.0.10/source/Makefile.in	2004-12-17 03:55:29.000000000 -0800
4@@ -90,6 +90,13 @@
5 # the directory where lock files go
6 LOCKDIR = @lockdir@
7 
8+# FHS directories; equal to LOCKDIR if not using --with-fhs
9+CACHEDIR = @cachedir@
10+STATEDIR = @statedir@
11+
12+# Where to look for (and install) codepage databases.
13+CODEPAGEDIR = @codepagedir@
14+
15 # the directory where pid files go
16 PIDDIR = @piddir@
17 # man pages language(s)
18@@ -114,7 +121,7 @@
19 PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\"  -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
20 PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
21 	      -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
22-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
23+PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" -DCACHEDIR=\"$(CACHEDIR)\" -DSTATEDIR=\"$(STATEDIR)\"
24 PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
25 
26 # Note that all executable programs now provide for an optional executable suffix.
27@@ -1319,7 +1326,7 @@
28 	@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
29 
30 installdat: installdirs
31-	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir)
32+	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(CODEPAGEDIR) $(srcdir)
33 
34 installmsg: installdirs
35 	@$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir)
36diff -uNr samba-3.0.10.orig/source/configure.in samba-3.0.10/source/configure.in
37--- samba-3.0.10.orig/source/configure.in	2004-12-17 03:50:08.000000000 -0800
38+++ samba-3.0.10/source/configure.in	2004-12-17 03:55:29.000000000 -0800
39@@ -35,7 +35,7 @@
40 [  --with-fhs              Use FHS-compliant paths (default=no)],
41 [ case "$withval" in
42   yes)
43-    lockdir="\${VARDIR}/lib/samba"
44+    lockdir="\${VARDIR}/run/samba"
45     piddir="\${VARDIR}/run"
46     mandir="\${prefix}/share/man"
47     logfilebase="\${VARDIR}/log/samba"
48@@ -43,6 +43,10 @@
49     libdir="\${prefix}/lib/samba"
50     configdir="${sysconfdir}/samba"
51     swatdir="\${DATADIR}/samba/swat"
52+    codepagedir="\${DATADIR}/samba"
53+    statedir="\${VARDIR}/lib/samba"
54+    cachedir="\${VARDIR}/cache/samba"
55+    AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
56     ;;
57   esac])
58 
59@@ -201,6 +205,9 @@
60 AC_SUBST(sbindir)
61 AC_SUBST(rootsbindir)
62 AC_SUBST(pammodulesdir)
63+AC_SUBST(codepagedir)
64+AC_SUBST(statedir)
65+AC_SUBST(cachedir)
66 
67 dnl Unique-to-Samba variables we'll be playing with.
68 AC_SUBST(SHELL)
69diff -uNr samba-3.0.10.orig/source/dynconfig.c samba-3.0.10/source/dynconfig.c
70--- samba-3.0.10.orig/source/dynconfig.c	2004-12-17 03:50:08.000000000 -0800
71+++ samba-3.0.10/source/dynconfig.c	2004-12-17 03:55:29.000000000 -0800
72@@ -53,6 +53,13 @@
73 pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
74 
75 /**
76+ * @brief Samba data directory.
77+ *
78+ * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
79+ **/
80+pstring dyn_CODEPAGEDIR = CODEPAGEDIR;
81+
82+/**
83  * @brief Samba library directory.
84  *
85  * @sa lib_path() to get the path to a file inside the LIBDIR.
86@@ -70,3 +77,27 @@
87 
88 pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
89 pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
90+
91+
92+/* In non-FHS mode, these should be configurable using 'lock dir =';
93+   but in FHS mode, they are their own directory.  Implement as wrapper
94+   functions so that everything can still be kept in dynconfig.c.
95+ */
96+
97+char *dyn_STATEDIR(void)
98+{
99+#ifdef FHS_COMPATIBLE
100+	return STATEDIR;
101+#else
102+	return lp_lockdir();
103+#endif
104+}
105+
106+char *dyn_CACHEDIR(void)
107+{
108+#ifdef FHS_COMPATIBLE
109+	return CACHEDIR;
110+#else
111+	return lp_lockdir();
112+#endif
113+}
114diff -uNr samba-3.0.10.orig/source/include/dynconfig.h samba-3.0.10/source/include/dynconfig.h
115--- samba-3.0.10.orig/source/include/dynconfig.h	2004-12-17 03:50:08.000000000 -0800
116+++ samba-3.0.10/source/include/dynconfig.h	2004-12-17 03:55:29.000000000 -0800
117@@ -31,8 +31,12 @@
118 extern pstring dyn_CONFIGFILE;
119 extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
120 extern pstring dyn_LIBDIR;
121+extern pstring dyn_CODEPAGEDIR;
122 extern fstring dyn_SHLIBEXT;
123 extern pstring dyn_LOCKDIR;
124 extern pstring dyn_PIDDIR;
125 extern pstring dyn_SMB_PASSWD_FILE;
126 extern pstring dyn_PRIVATE_DIR;
127+
128+char *dyn_STATEDIR(void);
129+char *dyn_CACHEDIR(void);
130diff -uNr samba-3.0.10.orig/source/intl/lang_tdb.c samba-3.0.10/source/intl/lang_tdb.c
131--- samba-3.0.10.orig/source/intl/lang_tdb.c	2004-12-17 03:50:08.000000000 -0800
132+++ samba-3.0.10/source/intl/lang_tdb.c	2004-12-17 03:55:29.000000000 -0800
133@@ -128,7 +128,7 @@
134 	if (!lang) 
135 		return True;
136 
137-	asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
138+	asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
139 	if (stat(msg_path, &st) != 0) {
140 		/* the msg file isn't available */
141 		DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path, 
142diff -uNr samba-3.0.10.orig/source/lib/util.c samba-3.0.10/source/lib/util.c
143--- samba-3.0.10.orig/source/lib/util.c	2004-12-17 03:50:08.000000000 -0800
144+++ samba-3.0.10/source/lib/util.c	2004-12-17 03:55:29.000000000 -0800
145@@ -2362,6 +2362,61 @@
146 }
147 
148 /**
149+ * @brief Returns an absolute path to a file in the Samba data directory.
150+ *
151+ * @param name File to find, relative to CODEPAGEDIR.
152+ *
153+ * @retval Pointer to a static #pstring containing the full path.
154+ **/
155+
156+char *data_path(const char *name)
157+{
158+	static pstring fname;
159+	snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
160+	return fname;
161+}
162+
163+/*****************************************************************
164+a useful function for returning a path in the Samba state directory
165+ *****************************************************************/
166+char *state_path(char *name)
167+{
168+	static pstring fname;
169+
170+	pstrcpy(fname,dyn_STATEDIR());
171+	trim_string(fname,"","/");
172+
173+	if (!directory_exist(fname,NULL)) {
174+		mkdir(fname,0755);
175+	}
176+
177+	pstrcat(fname,"/");
178+	pstrcat(fname,name);
179+
180+	return fname;
181+}
182+
183+/*****************************************************************
184+a useful function for returning a path in the Samba cache directory
185+ *****************************************************************/
186+char *cache_path(char *name)
187+{
188+	static pstring fname;
189+
190+	pstrcpy(fname,dyn_CACHEDIR());
191+	trim_string(fname,"","/");
192+
193+	if (!directory_exist(fname,NULL)) {
194+			mkdir(fname,0755);
195+	}
196+
197+	pstrcat(fname,"/");
198+	pstrcat(fname,name);
199+
200+	return fname;
201+}
202+
203+/**
204  * @brief Returns the platform specific shared library extension.
205  *
206  * @retval Pointer to a static #fstring containing the extension.
207diff -uNr samba-3.0.10.orig/source/libsmb/samlogon_cache.c samba-3.0.10/source/libsmb/samlogon_cache.c
208--- samba-3.0.10.orig/source/libsmb/samlogon_cache.c	2004-12-17 03:50:08.000000000 -0800
209+++ samba-3.0.10/source/libsmb/samlogon_cache.c	2004-12-17 03:55:29.000000000 -0800
210@@ -34,7 +34,7 @@
211 BOOL netsamlogon_cache_init(void)
212 {
213 	if (!netsamlogon_tdb) {
214-		netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
215+		netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
216 						   TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
217 	}
218 
219diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c samba-3.0.10/source/nmbd/nmbd_serverlistdb.c
220--- samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c	2004-12-17 03:50:09.000000000 -0800
221+++ samba-3.0.10/source/nmbd/nmbd_serverlistdb.c	2004-12-17 03:55:29.000000000 -0800
222@@ -327,7 +327,7 @@
223 
224 	updatecount++;
225     
226-	pstrcpy(fname,lp_lockdir());
227+	pstrcpy(fname,dyn_CACHEDIR());
228 	trim_char(fname,'\0' ,'/');
229 	pstrcat(fname,"/");
230 	pstrcat(fname,SERVER_LIST);
231diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c samba-3.0.10/source/nmbd/nmbd_winsserver.c
232--- samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c	2004-12-17 03:50:09.000000000 -0800
233+++ samba-3.0.10/source/nmbd/nmbd_winsserver.c	2004-12-17 03:55:30.000000000 -0800
234@@ -234,7 +234,7 @@
235 
236 	add_samba_names_to_subnet(wins_server_subnet);
237 
238-	if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
239+	if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
240 		DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
241 			WINS_LIST, strerror(errno) ));
242 		return True;
243@@ -1810,7 +1810,7 @@
244 		}
245 	}
246 
247-	slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
248+	slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
249 	all_string_sub(fname,"//", "/", 0);
250 	slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
251 
252diff -uNr samba-3.0.23.orig/source/nsswitch/winbindd_cache.c samba-3.0.23/source/nsswitch/winbindd_cache.c
253--- samba-3.0.23.orig/source/nsswitch/winbindd_cache.c	2006-07-15 09:50:09.000000000 -0400
254+++ samba-3.0.23/source/nsswitch/winbindd_cache.c	2006-07-15 09:55:30.000000000 -0400
255@@ -57,7 +57,7 @@
256 		return True;
257 
258 	/* when working offline we must not clear the cache on restart */
259-	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
260+	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
261 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
262 				TDB_DEFAULT /*TDB_CLEAR_IF_FIRST*/, O_RDWR|O_CREAT, 0600);
263 
264@@ -2223,9 +2223,9 @@
265 		tdb_close(wcache->tdb);
266 		wcache->tdb = NULL;
267 
268-		if (unlink(lock_path("winbindd_cache.tdb")) == -1) {
269+		if (unlink(cache_path("winbindd_cache.tdb")) == -1) {
270 			DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ",
271-				lock_path("winbindd_cache.tdb"),
272+				cache_path("winbindd_cache.tdb"),
273 				strerror(errno) ));
274 			return False;
275 		}
276@@ -2487,7 +2487,7 @@
277 		return;
278 
279 	/* when working offline we must not clear the cache on restart */
280-	wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
281+	wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"),
282 				WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, 
283 				lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), 
284 				O_RDWR|O_CREAT, 0600);
285diff -uNr samba-3.0.10.orig/source/param/loadparm.c samba-3.0.10/source/param/loadparm.c
286--- samba-3.0.10.orig/source/param/loadparm.c	2004-12-17 03:50:09.000000000 -0800
287+++ samba-3.0.10/source/param/loadparm.c	2004-12-17 03:55:30.000000000 -0800
288@@ -104,6 +104,9 @@
289 	char *szAddPrinterCommand;
290 	char *szDeletePrinterCommand;
291 	char *szOs2DriverMap;
292+#ifdef FHS_COMPATIBLE
293+	char *szLockDirStub;
294+#endif
295 	char *szLockDir;
296 	char *szPidDir;
297 	char *szRootdir;
298@@ -1105,8 +1108,13 @@
299 	{"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, 
300 	{"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
301 	{"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
302+#ifdef FHS_COMPATIBLE
303+	{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0}, 
304+	{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
305+#else
306 	{"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED}, 
307 	{"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE}, 
308+#endif
309 	{"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED}, 
310 #ifdef WITH_UTMP
311 	{"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
312diff -uNr samba-3.0.23.orig/source/passdb/pdb_tdb.c samba-3.0.23/source/passdb/pdb_tdb.c
313--- samba-3.0.23.orig/source/passdb/pdb_tdb.c	2006-07-15 09:50:09.000000000 -0400
314+++ samba-3.0.23/source/passdb/pdb_tdb.c	2006-07-15 09:55:30.000000000 -0400
315@@ -1598,7 +1598,7 @@
316 	/* save the path for later */
317 			   
318 	if ( !location ) {
319-		pstr_sprintf( tdbfile, "%s/%s", lp_private_dir(), PASSDB_FILE_NAME );
320+		pstr_sprintf( tdbfile, "%s", state_path(PASSDB_FILE_NAME) );
321 		pfile = tdbfile;
322 	}
323 	pstrcpy( tdbsam_filename, pfile );
324diff -uNr samba-3.0.10.orig/source/passdb/secrets.c samba-3.0.10/source/passdb/secrets.c
325--- samba-3.0.10.orig/source/passdb/secrets.c	2004-12-17 03:50:09.000000000 -0800
326+++ samba-3.0.10/source/passdb/secrets.c	2004-12-17 03:55:30.000000000 -0800
327@@ -55,8 +55,7 @@
328 	if (tdb)
329 		return True;
330 
331-	pstrcpy(fname, lp_private_dir());
332-	pstrcat(fname,"/secrets.tdb");
333+	pstrcpy(fname, state_path("secrets.tdb"));
334 
335 	tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
336 
337diff -uNr samba-3.0.10.orig/source/printing/nt_printing.c samba-3.0.10/source/printing/nt_printing.c
338--- samba-3.0.10.orig/source/printing/nt_printing.c	2004-12-17 03:50:09.000000000 -0800
339+++ samba-3.0.10/source/printing/nt_printing.c	2004-12-17 03:55:31.000000000 -0800
340@@ -298,28 +298,28 @@
341  
342 	if (tdb_drivers)
343 		tdb_close(tdb_drivers);
344-	tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
345+	tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
346 	if (!tdb_drivers) {
347 		DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
348-			lock_path("ntdrivers.tdb"), strerror(errno) ));
349+			state_path("ntdrivers.tdb"), strerror(errno) ));
350 		return False;
351 	}
352  
353 	if (tdb_printers)
354 		tdb_close(tdb_printers);
355-	tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
356+	tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
357 	if (!tdb_printers) {
358 		DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
359-			lock_path("ntprinters.tdb"), strerror(errno) ));
360+			state_path("ntprinters.tdb"), strerror(errno) ));
361 		return False;
362 	}
363  
364 	if (tdb_forms)
365 		tdb_close(tdb_forms);
366-	tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
367+	tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
368 	if (!tdb_forms) {
369 		DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
370-			lock_path("ntforms.tdb"), strerror(errno) ));
371+			state_path("ntforms.tdb"), strerror(errno) ));
372 		return False;
373 	}
374  
375diff -uNr samba-3.0.10.orig/source/printing/printing.c samba-3.0.10/source/printing/printing.c
376--- samba-3.0.10.orig/source/printing/printing.c	2004-12-17 03:50:09.000000000 -0800
377+++ samba-3.0.10/source/printing/printing.c	2004-12-17 03:55:31.000000000 -0800
378@@ -177,8 +177,8 @@
379 	int services = lp_numservices();
380 	int snum;
381 
382-	unlink(lock_path("printing.tdb"));
383-	pstrcpy(printing_path,lock_path("printing"));
384+	unlink(cache_path("printing.tdb"));
385+	pstrcpy(printing_path,cache_path("printing"));
386 	mkdir(printing_path,0755);
387 
388 	/* handle a Samba upgrade */
389diff -uNr samba-3.0.10.orig/source/printing/printing_db.c samba-3.0.10/source/printing/printing_db.c
390--- samba-3.0.10.orig/source/printing/printing_db.c	2004-12-17 03:50:09.000000000 -0800
391+++ samba-3.0.10/source/printing/printing_db.c	2004-12-17 03:55:31.000000000 -0800
392@@ -89,7 +89,7 @@
393 		DLIST_ADD(print_db_head, p);
394 	}
395 
396-	pstrcpy(printdb_path, lock_path("printing/"));
397+	pstrcpy(printdb_path, cache_path("printing/"));
398 	pstrcat(printdb_path, printername);
399 	pstrcat(printdb_path, ".tdb");
400 
401diff -uNr samba-3.0.21.orig/source/registry/reg_db.c samba-3.0.21/source/registry/reg_db.c
402--- samba-3.0.21.orig/source/registry/reg_db.c	2005-10-18 02:45:06.000000000 +0000
403+++ samba-3.0.21/source/registry/reg_db.c	2005-12-23 11:48:19.000000000 +0000
404@@ -205,12 +205,12 @@
405 	if ( tdb_reg )
406 		return True;
407 
408-	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
409+	if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
410 	{
411-		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
412+		tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
413 		if ( !tdb_reg ) {
414 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
415-				lock_path("registry.tdb"), strerror(errno) ));
416+				state_path("registry.tdb"), strerror(errno) ));
417 			return False;
418 		}
419 		
420@@ -252,11 +252,11 @@
421 	
422 	become_root();
423 
424-	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
425+	tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
426 	if ( !tdb_reg ) {
427 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
428 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
429-			lock_path("registry.tdb"), strerror(errno) ));
430+			state_path("registry.tdb"), strerror(errno) ));
431 	}
432 
433 	unbecome_root();
434diff -uNr samba-3.0.23.orig/source/lib/sharesec.c samba-3.0.23/source/lib/sharesec.c
435--- samba-3.0.23.orig/source/lib/sharesec.c	2006-07-15 09:50:09.000000000 -0400
436+++ samba-3.0.23/source/lib/sharesec.c	2006-07-15 09:55:31.000000000 -0400
437@@ -47,10 +47,10 @@
438 		return True;
439 	}
440 
441-	share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
442+	share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
443 	if (!share_tdb) {
444 		DEBUG(0,("Failed to open share info database %s (%s)\n",
445-			lock_path("share_info.tdb"), strerror(errno) ));
446+			state_path("share_info.tdb"), strerror(errno) ));
447 		return False;
448 	}
449  
450diff -uNr samba-3.0.23.orig/source/smbd/lanman.c samba-3.0.23/source/smbd/lanman.c
451--- samba-3.0.23.orig/source/smbd/lanman.c	2006-07-15 09:50:10.000000000 -0400
452+++ samba-3.0.23/source/smbd/lanman.c	2006-07-15 09:55:31.000000000 -0400
453@@ -1052,9 +1052,9 @@
454 	BOOL local_list_only;
455 	int i;
456 
457-	lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0);
458+	lines = file_lines_load(cache_path(SERVER_LIST), NULL, 0);
459 	if (!lines) {
460-		DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
461+		DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
462 		return 0;
463 	}
464
465diff -uNr samba-3.0.11.orig/source/printing/nt_printing.c samba-3.0.11/source/printing/nt_printing.c
466--- samba-3.0.11.orig/source/printing/nt_printing.c	2005-03-23 02:51:08.000000000 -0800
467+++ samba-3.0.11/source/printing/nt_printing.c	2005-03-23 02:54:33.000000000 -0800
468@@ -2065,7 +2065,7 @@
469 	close_all_print_db();
470 
471 	if (geteuid() == 0) {
472-		pstrcpy(printdb_path, lock_path("printing/"));
473+		pstrcpy(printdb_path, cache_path("printing/"));
474 		pstrcat(printdb_path, sharename);
475 		pstrcat(printdb_path, ".tdb");
476 
477diff -uPr samba-3.0.25a.orig/source/groupdb/mapping_tdb.c samba-3.0.25a/source/groupdb/mapping_tdb.c
478--- samba-3.0.25a.orig/source/groupdb/mapping_tdb.c	2007-04-25 09:38:59.000000000 +0000
479+++ samba-3.0.25a/source/groupdb/mapping_tdb.c	2007-05-29 00:28:42.000000000 +0000
480@@ -39,7 +39,7 @@
481 	if (tdb)
482 		return True;
483 		
484-	tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
485+	tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
486 	if (!tdb) {
487 		DEBUG(0,("Failed to open group mapping database\n"));
488 		return False;
489diff -uPr samba-3.0.25a.orig/source/lib/account_pol.c samba-3.0.25a/source/lib/account_pol.c
490--- samba-3.0.25a.orig/source/lib/account_pol.c	2007-03-01 04:54:30.000000000 +0000
491+++ samba-3.0.25a/source/lib/account_pol.c	2007-05-29 00:21:35.000000000 +0000
492@@ -213,9 +213,9 @@
493 		return True;
494 	}
495 
496-	tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
497+	tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
498 	if (!tdb) { /* the account policies files does not exist or open failed, try to create a new one */
499-		tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
500+		tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
501 		if (!tdb) {
502 			DEBUG(0,("Failed to open account policy database\n"));
503 			return False;
504diff -uPr samba-3.0.25a.orig/source/lib/util_unistr.c samba-3.0.25a/source/lib/util_unistr.c
505--- samba-3.0.25a.orig/source/lib/util_unistr.c	2007-03-01 04:54:30.000000000 +0000
506+++ samba-3.0.25a/source/lib/util_unistr.c	2007-05-29 00:24:07.000000000 +0000
507@@ -88,11 +88,11 @@
508 	}
509 	initialised = 1;
510 
511-	upcase_table = (smb_ucs2_t *)map_file(lib_path("upcase.dat"),
512+	upcase_table = (smb_ucs2_t *)map_file(data_path("upcase.dat"),
513 					      0x20000);
514 	upcase_table_use_unmap = ( upcase_table != NULL );
515 
516-	lowcase_table = (smb_ucs2_t *)map_file(lib_path("lowcase.dat"),
517+	lowcase_table = (smb_ucs2_t *)map_file(data_path("lowcase.dat"),
518 					       0x20000);
519 	lowcase_table_use_unmap = ( lowcase_table != NULL );
520 
521@@ -230,7 +230,7 @@
522 		return;
523 	}
524 
525-	valid_file = (uint8 *)map_file(lib_path("valid.dat"), 0x10000);
526+	valid_file = (uint8 *)map_file(data_path("valid.dat"), 0x10000);
527 	if (valid_file) {
528 		valid_table = valid_file;
529 		mapped_file = 1;
530diff -uPr samba-3.0.25a.orig/source/libsmb/samlogon_cache.c samba-3.0.25a/source/libsmb/samlogon_cache.c
531--- samba-3.0.25a.orig/source/libsmb/samlogon_cache.c	2007-05-10 22:09:35.000000000 +0000
532+++ samba-3.0.25a/source/libsmb/samlogon_cache.c	2007-05-29 00:38:41.000000000 +0000
533@@ -67,7 +67,7 @@
534            winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
535 
536 	if (!tdb) {
537-		tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 
538+		tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 
539 				   WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
540 				   TDB_DEFAULT, O_RDWR, 0600);
541 		if (!tdb) {
542diff -uPr samba-3.0.25a.orig/source/nsswitch/idmap_tdb.c samba-3.0.25a/source/nsswitch/idmap_tdb.c
543--- samba-3.0.25a.orig/source/nsswitch/idmap_tdb.c	2007-05-10 22:09:34.000000000 +0000
544+++ samba-3.0.25a/source/nsswitch/idmap_tdb.c	2007-05-29 00:27:55.000000000 +0000
545@@ -247,7 +247,7 @@
546 	}
547 
548 	/* use the old database if present */
549-	tdbfile = talloc_strdup(ctx, lock_path("winbindd_idmap.tdb"));
550+	tdbfile = talloc_strdup(ctx, state_path("winbindd_idmap.tdb"));
551 	if (!tdbfile) {
552 		DEBUG(0, ("Out of memory!\n"));
553 		ret = NT_STATUS_NO_MEMORY;
554diff -uPr samba-3.0.25a.orig/source/passdb/pdb_tdb.c samba-3.0.25a/source/passdb/pdb_tdb.c
555--- samba-3.0.25a.orig/source/passdb/pdb_tdb.c	2007-03-01 04:54:41.000000000 +0000
556+++ samba-3.0.25a/source/passdb/pdb_tdb.c	2007-05-29 00:38:41.000000000 +0000
557@@ -1559,7 +1559,7 @@
558 	uint32 rid;
559 	BOOL ret = False;
560 
561-	tdb = tdb_open_log(lock_path("winbindd_idmap.tdb"), 0,
562+	tdb = tdb_open_log(state_path("winbindd_idmap.tdb"), 0,
563 			   TDB_DEFAULT, O_RDWR | O_CREAT, 0644);
564 
565 	if (tdb == NULL) {
566