957ce7fae9deaddf7d8d2d7eab02de95b914fbc1
[ira/wip.git] / packaging / Debian / debian-sarge / patches / fhs.patch
1 diff -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)
36 diff -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(swatdir)
61  AC_SUBST(bindir)
62  AC_SUBST(sbindir)
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)
69 diff -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  const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
89  const 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 +}
114 diff -uNr samba-3.0.10.orig/source/groupdb/mapping.c samba-3.0.10/source/groupdb/mapping.c
115 --- samba-3.0.10.orig/source/groupdb/mapping.c  2004-12-17 03:50:08.000000000 -0800
116 +++ samba-3.0.10/source/groupdb/mapping.c       2004-12-17 03:55:29.000000000 -0800
117 @@ -140,7 +140,7 @@
118         
119         if (tdb)
120                 return True;
121 -       tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
122 +       tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
123         if (!tdb) {
124                 DEBUG(0,("Failed to open group mapping database\n"));
125                 return False;
126 diff -uNr samba-3.0.10.orig/source/include/dynconfig.h samba-3.0.10/source/include/dynconfig.h
127 --- samba-3.0.10.orig/source/include/dynconfig.h        2004-12-17 03:50:08.000000000 -0800
128 +++ samba-3.0.10/source/include/dynconfig.h     2004-12-17 03:55:29.000000000 -0800
129 @@ -31,8 +31,12 @@
130  extern pstring dyn_CONFIGFILE;
131  extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
132  extern pstring dyn_LIBDIR;
133 +extern pstring dyn_CODEPAGEDIR;
134  extern const fstring dyn_SHLIBEXT;
135  extern const pstring dyn_LOCKDIR; 
136  extern const pstring dyn_PIDDIR;
137  extern const pstring dyn_SMB_PASSWD_FILE;
138  extern const pstring dyn_PRIVATE_DIR;
139 +
140 +char *dyn_STATEDIR(void);
141 +char *dyn_CACHEDIR(void);
142 diff -uNr samba-3.0.10.orig/source/intl/lang_tdb.c samba-3.0.10/source/intl/lang_tdb.c
143 --- samba-3.0.10.orig/source/intl/lang_tdb.c    2004-12-17 03:50:08.000000000 -0800
144 +++ samba-3.0.10/source/intl/lang_tdb.c 2004-12-17 03:55:29.000000000 -0800
145 @@ -128,7 +128,7 @@
146         if (!lang) 
147                 return True;
148  
149 -       asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
150 +       asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
151         if (stat(msg_path, &st) != 0) {
152                 /* the msg file isn't available */
153                 DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path, 
154 diff -uNr samba-3.0.21.orig/source/lib/account_pol.c samba-3.0.21/source/lib/account_pol.c
155 --- samba-3.0.21.orig/source/lib/account_pol.c  2005-12-20 15:28:38.000000000 +0000
156 +++ samba-3.0.21/source/lib/account_pol.c       2005-12-23 11:41:08.000000000 +0000
157 @@ -262,7 +262,7 @@
158                 return True;
159         }
160  
161 -       tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
162 +       tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
163         if (!tdb) {
164                 DEBUG(0,("Failed to open account policy database\n"));
165                 return False;
166 diff -uNr samba-3.0.10.orig/source/lib/util.c samba-3.0.10/source/lib/util.c
167 --- samba-3.0.10.orig/source/lib/util.c 2004-12-17 03:50:08.000000000 -0800
168 +++ samba-3.0.10/source/lib/util.c      2004-12-17 03:55:29.000000000 -0800
169 @@ -2362,6 +2362,61 @@
170  }
171  
172  /**
173 + * @brief Returns an absolute path to a file in the Samba data directory.
174 + *
175 + * @param name File to find, relative to CODEPAGEDIR.
176 + *
177 + * @retval Pointer to a static #pstring containing the full path.
178 + **/
179 +
180 +char *data_path(const char *name)
181 +{
182 +       static pstring fname;
183 +       snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
184 +       return fname;
185 +}
186 +
187 +/*****************************************************************
188 +a useful function for returning a path in the Samba state directory
189 + *****************************************************************/
190 +char *state_path(char *name)
191 +{
192 +       static pstring fname;
193 +
194 +       pstrcpy(fname,dyn_STATEDIR());
195 +       trim_string(fname,"","/");
196 +
197 +       if (!directory_exist(fname,NULL)) {
198 +               mkdir(fname,0755);
199 +       }
200 +
201 +       pstrcat(fname,"/");
202 +       pstrcat(fname,name);
203 +
204 +       return fname;
205 +}
206 +
207 +/*****************************************************************
208 +a useful function for returning a path in the Samba cache directory
209 + *****************************************************************/
210 +char *cache_path(char *name)
211 +{
212 +       static pstring fname;
213 +
214 +       pstrcpy(fname,dyn_CACHEDIR());
215 +       trim_string(fname,"","/");
216 +
217 +       if (!directory_exist(fname,NULL)) {
218 +                       mkdir(fname,0755);
219 +       }
220 +
221 +       pstrcat(fname,"/");
222 +       pstrcat(fname,name);
223 +
224 +       return fname;
225 +}
226 +
227 +/**
228   * @brief Returns the platform specific shared library extension.
229   *
230   * @retval Pointer to a static #fstring containing the extension.
231 diff -uNr samba-3.0.10.orig/source/lib/util_unistr.c samba-3.0.10/source/lib/util_unistr.c
232 --- samba-3.0.10.orig/source/lib/util_unistr.c  2004-12-17 03:50:08.000000000 -0800
233 +++ samba-3.0.10/source/lib/util_unistr.c       2004-12-17 03:55:29.000000000 -0800
234 @@ -54,8 +54,8 @@
235         if (initialised) return;
236         initialised = 1;
237  
238 -       upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
239 -       lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
240 +       upcase_table = map_file(data_path("upcase.dat"), 0x20000);
241 +       lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
242  
243         /* we would like Samba to limp along even if these tables are
244            not available */
245 @@ -161,7 +161,7 @@
246                 return;
247         }
248  
249 -       valid_file = map_file(lib_path("valid.dat"), 0x10000);
250 +       valid_file = map_file(data_path("valid.dat"), 0x10000);
251         if (valid_file) {
252                 valid_table = valid_file;
253                 mapped_file = 1;
254 diff -uNr samba-3.0.10.orig/source/libsmb/samlogon_cache.c samba-3.0.10/source/libsmb/samlogon_cache.c
255 --- samba-3.0.10.orig/source/libsmb/samlogon_cache.c    2004-12-17 03:50:08.000000000 -0800
256 +++ samba-3.0.10/source/libsmb/samlogon_cache.c 2004-12-17 03:55:29.000000000 -0800
257 @@ -34,7 +34,7 @@
258  BOOL netsamlogon_cache_init(void)
259  {
260         if (!netsamlogon_tdb) {
261 -               netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
262 +               netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
263                                                    TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
264         }
265  
266 @@ -67,7 +67,7 @@
267             winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
268  
269         if (!tdb) {
270 -               tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,
271 +               tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000,
272                                    TDB_DEFAULT, O_RDWR, 0600);
273                 if (!tdb) {
274                         DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n"));
275 diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c samba-3.0.10/source/nmbd/nmbd_serverlistdb.c
276 --- samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c   2004-12-17 03:50:09.000000000 -0800
277 +++ samba-3.0.10/source/nmbd/nmbd_serverlistdb.c        2004-12-17 03:55:29.000000000 -0800
278 @@ -327,7 +327,7 @@
279  
280         updatecount++;
281      
282 -       pstrcpy(fname,lp_lockdir());
283 +       pstrcpy(fname,dyn_CACHEDIR());
284         trim_char(fname,'\0' ,'/');
285         pstrcat(fname,"/");
286         pstrcat(fname,SERVER_LIST);
287 diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c samba-3.0.10/source/nmbd/nmbd_winsserver.c
288 --- samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c     2004-12-17 03:50:09.000000000 -0800
289 +++ samba-3.0.10/source/nmbd/nmbd_winsserver.c  2004-12-17 03:55:30.000000000 -0800
290 @@ -234,7 +234,7 @@
291  
292         add_samba_names_to_subnet(wins_server_subnet);
293  
294 -       if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
295 +       if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
296                 DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
297                         WINS_LIST, strerror(errno) ));
298                 return True;
299 @@ -1810,7 +1810,7 @@
300                 }
301         }
302  
303 -       slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
304 +       slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
305         all_string_sub(fname,"//", "/", 0);
306         slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
307  
308 diff -uNr samba-3.0.10.orig/source/nsswitch/winbindd_cache.c samba-3.0.10/source/nsswitch/winbindd_cache.c
309 --- samba-3.0.10.orig/source/nsswitch/winbindd_cache.c  2004-12-17 03:50:09.000000000 -0800
310 +++ samba-3.0.10/source/nsswitch/winbindd_cache.c       2004-12-17 03:55:30.000000000 -0800
311 @@ -57,7 +57,7 @@
312         if (opt_nocache)
313                 return;
314  
315 -       wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000, 
316 +       wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000, 
317                                    TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0600);
318  
319         if (!wcache->tdb) {
320 diff -uNr samba-3.0.10.orig/source/nsswitch/winbindd_util.c samba-3.0.10/source/nsswitch/winbindd_util.c
321 --- samba-3.0.10.orig/source/nsswitch/winbindd_util.c   2004-12-17 03:50:09.000000000 -0800
322 +++ samba-3.0.10/source/nsswitch/winbindd_util.c        2004-12-17 03:55:30.000000000 -0800
323 @@ -957,7 +957,7 @@
324         SMB_STRUCT_STAT stbuf;
325         TDB_CONTEXT *idmap_tdb;
326  
327 -       pstrcpy(idmap_name, lock_path("winbindd_idmap.tdb"));
328 +       pstrcpy(idmap_name, state_path("winbindd_idmap.tdb"));
329  
330         if (!file_exist(idmap_name, &stbuf)) {
331                 /* nothing to convert return */
332 diff -uNr samba-3.0.10.orig/source/param/loadparm.c samba-3.0.10/source/param/loadparm.c
333 --- samba-3.0.10.orig/source/param/loadparm.c   2004-12-17 03:50:09.000000000 -0800
334 +++ samba-3.0.10/source/param/loadparm.c        2004-12-17 03:55:30.000000000 -0800
335 @@ -104,6 +104,9 @@
336         char *szAddPrinterCommand;
337         char *szDeletePrinterCommand;
338         char *szOs2DriverMap;
339 +#ifdef FHS_COMPATIBLE
340 +       char *szLockDirStub;
341 +#endif
342         char *szLockDir;
343         char *szPidDir;
344         char *szRootdir;
345 @@ -1105,8 +1108,13 @@
346         {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, 
347         {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
348         {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
349 +#ifdef FHS_COMPATIBLE
350 +       {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0}, 
351 +       {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
352 +#else
353         {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED}, 
354         {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE}, 
355 +#endif
356         {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED}, 
357  #ifdef WITH_UTMP
358         {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
359 diff -uNr samba-3.0.10.orig/source/passdb/pdb_tdb.c samba-3.0.10/source/passdb/pdb_tdb.c
360 --- samba-3.0.10.orig/source/passdb/pdb_tdb.c   2004-12-17 03:50:09.000000000 -0800
361 +++ samba-3.0.10/source/passdb/pdb_tdb.c        2004-12-17 03:55:30.000000000 -0800
362 @@ -734,10 +734,7 @@
363         if (location) {
364                 tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, location);
365         } else {
366 -               pstring tdbfile;
367 -               get_private_directory(tdbfile);
368 -               pstrcat(tdbfile, "/");
369 -               pstrcat(tdbfile, PASSDB_FILE_NAME);
370 +               char *tdbfile = state_path(PASSDB_FILE_NAME);
371                 tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, tdbfile);
372         }
373  
374 diff -uNr samba-3.0.10.orig/source/passdb/secrets.c samba-3.0.10/source/passdb/secrets.c
375 --- samba-3.0.10.orig/source/passdb/secrets.c   2004-12-17 03:50:09.000000000 -0800
376 +++ samba-3.0.10/source/passdb/secrets.c        2004-12-17 03:55:30.000000000 -0800
377 @@ -55,8 +55,7 @@
378         if (tdb)
379                 return True;
380  
381 -       pstrcpy(fname, lp_private_dir());
382 -       pstrcat(fname,"/secrets.tdb");
383 +       pstrcpy(fname, state_path("secrets.tdb"));
384  
385         tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
386  
387 diff -uNr samba-3.0.10.orig/source/printing/nt_printing.c samba-3.0.10/source/printing/nt_printing.c
388 --- samba-3.0.10.orig/source/printing/nt_printing.c     2004-12-17 03:50:09.000000000 -0800
389 +++ samba-3.0.10/source/printing/nt_printing.c  2004-12-17 03:55:31.000000000 -0800
390 @@ -298,28 +298,28 @@
391   
392         if (tdb_drivers)
393                 tdb_close(tdb_drivers);
394 -       tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
395 +       tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
396         if (!tdb_drivers) {
397                 DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
398 -                       lock_path("ntdrivers.tdb"), strerror(errno) ));
399 +                       state_path("ntdrivers.tdb"), strerror(errno) ));
400                 return False;
401         }
402   
403         if (tdb_printers)
404                 tdb_close(tdb_printers);
405 -       tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
406 +       tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
407         if (!tdb_printers) {
408                 DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
409 -                       lock_path("ntprinters.tdb"), strerror(errno) ));
410 +                       state_path("ntprinters.tdb"), strerror(errno) ));
411                 return False;
412         }
413   
414         if (tdb_forms)
415                 tdb_close(tdb_forms);
416 -       tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
417 +       tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
418         if (!tdb_forms) {
419                 DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
420 -                       lock_path("ntforms.tdb"), strerror(errno) ));
421 +                       state_path("ntforms.tdb"), strerror(errno) ));
422                 return False;
423         }
424   
425 diff -uNr samba-3.0.10.orig/source/printing/printing.c samba-3.0.10/source/printing/printing.c
426 --- samba-3.0.10.orig/source/printing/printing.c        2004-12-17 03:50:09.000000000 -0800
427 +++ samba-3.0.10/source/printing/printing.c     2004-12-17 03:55:31.000000000 -0800
428 @@ -177,8 +177,8 @@
429         int services = lp_numservices();
430         int snum;
431  
432 -       unlink(lock_path("printing.tdb"));
433 -       pstrcpy(printing_path,lock_path("printing"));
434 +       unlink(cache_path("printing.tdb"));
435 +       pstrcpy(printing_path,cache_path("printing"));
436         mkdir(printing_path,0755);
437  
438         /* handle a Samba upgrade */
439 diff -uNr samba-3.0.10.orig/source/printing/printing_db.c samba-3.0.10/source/printing/printing_db.c
440 --- samba-3.0.10.orig/source/printing/printing_db.c     2004-12-17 03:50:09.000000000 -0800
441 +++ samba-3.0.10/source/printing/printing_db.c  2004-12-17 03:55:31.000000000 -0800
442 @@ -89,7 +89,7 @@
443                 DLIST_ADD(print_db_head, p);
444         }
445  
446 -       pstrcpy(printdb_path, lock_path("printing/"));
447 +       pstrcpy(printdb_path, cache_path("printing/"));
448         pstrcat(printdb_path, printername);
449         pstrcat(printdb_path, ".tdb");
450  
451 diff -uNr samba-3.0.21.orig/source/registry/reg_db.c samba-3.0.21/source/registry/reg_db.c
452 --- samba-3.0.21.orig/source/registry/reg_db.c  2005-10-18 02:45:06.000000000 +0000
453 +++ samba-3.0.21/source/registry/reg_db.c       2005-12-23 11:48:19.000000000 +0000
454 @@ -205,12 +205,12 @@
455         if ( tdb_reg )
456                 return True;
457  
458 -       if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
459 +       if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
460         {
461 -               tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
462 +               tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
463                 if ( !tdb_reg ) {
464                         DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
465 -                               lock_path("registry.tdb"), strerror(errno) ));
466 +                               state_path("registry.tdb"), strerror(errno) ));
467                         return False;
468                 }
469                 
470 @@ -252,11 +252,11 @@
471         
472         become_root();
473  
474 -       tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
475 +       tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
476         if ( !tdb_reg ) {
477                 result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
478                 DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
479 -                       lock_path("registry.tdb"), strerror(errno) ));
480 +                       state_path("registry.tdb"), strerror(errno) ));
481         }
482  
483         unbecome_root();
484 diff -uNr samba-3.0.10.orig/source/rpc_server/srv_srvsvc_nt.c samba-3.0.10/source/rpc_server/srv_srvsvc_nt.c
485 --- samba-3.0.10.orig/source/rpc_server/srv_srvsvc_nt.c 2004-12-17 03:50:09.000000000 -0800
486 +++ samba-3.0.10/source/rpc_server/srv_srvsvc_nt.c      2004-12-17 03:55:31.000000000 -0800
487 @@ -133,10 +133,10 @@
488   
489         if (share_tdb && local_pid == sys_getpid())
490                 return True;
491 -       share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
492 +       share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
493         if (!share_tdb) {
494                 DEBUG(0,("Failed to open share info database %s (%s)\n",
495 -                       lock_path("share_info.tdb"), strerror(errno) ));
496 +                       state_path("share_info.tdb"), strerror(errno) ));
497                 return False;
498         }
499   
500 diff -uNr samba-3.0.10.orig/source/sam/idmap_tdb.c samba-3.0.10/source/sam/idmap_tdb.c
501 --- samba-3.0.10.orig/source/sam/idmap_tdb.c    2004-12-17 03:50:09.000000000 -0800
502 +++ samba-3.0.10/source/sam/idmap_tdb.c 2004-12-17 03:55:31.000000000 -0800
503 @@ -487,7 +487,7 @@
504         BOOL tdb_is_new = False;
505  
506         /* use the old database if present */
507 -       tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));
508 +       tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb"));
509         if (!tdbfile) {
510                 DEBUG(0, ("idmap_init: out of memory!\n"));
511                 return NT_STATUS_NO_MEMORY;
512 diff -uNr samba-3.0.10.orig/source/smbd/lanman.c samba-3.0.10/source/smbd/lanman.c
513 --- samba-3.0.10.orig/source/smbd/lanman.c      2004-12-17 03:50:10.000000000 -0800
514 +++ samba-3.0.10/source/smbd/lanman.c   2004-12-17 03:55:31.000000000 -0800
515 @@ -969,9 +969,9 @@
516    BOOL local_list_only;
517    int i;
518  
519 -  lines = file_lines_load(lock_path(SERVER_LIST), NULL);
520 +  lines = file_lines_load(cache_path(SERVER_LIST), NULL);
521    if (!lines) {
522 -    DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
523 +    DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
524      return(0);
525    }
526  
527 diff -uNr samba-3.0.10.orig/source/utils/net_idmap.c samba-3.0.10/source/utils/net_idmap.c
528 --- samba-3.0.10.orig/source/utils/net_idmap.c  2004-12-17 03:50:10.000000000 -0800
529 +++ samba-3.0.10/source/utils/net_idmap.c       2004-12-17 03:55:32.000000000 -0800
530 @@ -126,7 +126,7 @@
531                 return NT_STATUS_UNSUCCESSFUL;
532         }
533  
534 -       tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));
535 +       tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb"));
536         if (!tdbfile) {
537                 DEBUG(0, ("idmap_init: out of memory!\n"));
538                 return NT_STATUS_NO_MEMORY;
539 diff -uNr samba-3.0.10.orig/source/wrepld/process.c samba-3.0.10/source/wrepld/process.c
540 --- samba-3.0.10.orig/source/wrepld/process.c   2004-12-17 03:50:10.000000000 -0800
541 +++ samba-3.0.10/source/wrepld/process.c        2004-12-17 03:55:32.000000000 -0800
542 @@ -197,7 +197,7 @@
543  {
544         TDB_CONTEXT *tdb;
545  
546 -       tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
547 +       tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
548         if (!tdb) {
549                 DEBUG(2,("get_our_last_id: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
550                 return;
551 @@ -489,7 +489,7 @@
552                 }
553  
554  
555 -       tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
556 +       tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
557         if (!tdb) {
558                 DEBUG(2,("send_entry_request: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
559                 return;
560 diff -uNr samba-3.0.11.orig/source/printing/nt_printing.c samba-3.0.11/source/printing/nt_printing.c
561 --- samba-3.0.11.orig/source/printing/nt_printing.c     2005-03-23 02:51:08.000000000 -0800
562 +++ samba-3.0.11/source/printing/nt_printing.c  2005-03-23 02:54:33.000000000 -0800
563 @@ -2065,7 +2065,7 @@
564         close_all_print_db();
565  
566         if (geteuid() == 0) {
567 -               pstrcpy(printdb_path, lock_path("printing/"));
568 +               pstrcpy(printdb_path, cache_path("printing/"));
569                 pstrcat(printdb_path, sharename);
570                 pstrcat(printdb_path, ".tdb");
571