Initial import
[samba] / packaging / Debian / debian-woody / patches / fhs.patch
1 diff -uNr samba-3.0.0beta2.orig/source/Makefile.in samba-3.0.0beta2/source/Makefile.in
2 --- samba-3.0.0beta2.orig/source/Makefile.in    2003-07-02 23:26:46.000000000 -0500
3 +++ samba-3.0.0beta2/source/Makefile.in 2003-07-02 23:19:46.000000000 -0500
4 @@ -90,6 +91,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 +122,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 @@ -1203,7 +1211,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  installswat: installdirs
35         @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
36 diff -uNr samba-3.0.0beta2.orig/source/configure.in samba-3.0.0beta2/source/configure.in
37 --- samba-3.0.0beta2.orig/source/configure.in   2003-07-02 23:26:47.000000000 -0500
38 +++ samba-3.0.0beta2/source/configure.in        2003-07-02 23:19:02.000000000 -0500
39 @@ -17,14 +17,18 @@
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 +    piddir="\${VARDIR}/run/samba"
47      mandir="\${prefix}/share/man"
48      logfilebase="\${VARDIR}/log/samba"
49      privatedir="\${CONFIGDIR}/private"
50      libdir="\${prefix}/lib/samba"
51      configdir="${sysconfdir}/samba"
52 -    swatdir="\${DATADIR}/samba/swat"
53 +    swatdir="\${DATADIR}/samba/swat"
54 +    codepagedir="\${DATADIR}/samba"
55 +    statedir="\${VARDIR}/lib/samba"
56 +    cachedir="\${VARDIR}/cache/samba"
57 +    AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
58      ;;
59    esac])
60  
61 @@ -134,6 +141,9 @@
62  AC_SUBST(swatdir)
63  AC_SUBST(bindir)
64  AC_SUBST(sbindir)
65 +AC_SUBST(codepagedir)
66 +AC_SUBST(statedir)
67 +AC_SUBST(cachedir)
68  
69  dnl Unique-to-Samba variables we'll be playing with.
70  AC_SUBST(SHELL)
71 diff -uNr samba-3.0.0beta2.orig/source/dynconfig.c samba-3.0.0beta2/source/dynconfig.c
72 --- samba-3.0.0beta2.orig/source/dynconfig.c    2003-07-02 23:26:47.000000000 -0500
73 +++ samba-3.0.0beta2/source/dynconfig.c 2003-07-02 23:19:02.000000000 -0500
74 @@ -53,6 +53,13 @@
75  pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
76  
77  /**
78 + * @brief Samba data directory.
79 + *
80 + * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
81 + **/
82 +pstring dyn_CODEPAGEDIR = CODEPAGEDIR;
83 +
84 +/**
85   * @brief Samba library directory.
86   *
87   * @sa lib_path() to get the path to a file inside the LIBDIR.
88 @@ -70,3 +77,27 @@
89  
90  const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
91  const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
92 +
93 +
94 +/* In non-FHS mode, these should be configurable using 'lock dir =';
95 +   but in FHS mode, they are their own directory.  Implement as wrapper
96 +   functions so that everything can still be kept in dynconfig.c.
97 + */
98 +
99 +char *dyn_STATEDIR(void)
100 +{
101 +#ifdef FHS_COMPATIBLE
102 +       return STATEDIR;
103 +#else
104 +       return lp_lockdir();
105 +#endif
106 +}
107 +
108 +char *dyn_CACHEDIR(void)
109 +{
110 +#ifdef FHS_COMPATIBLE
111 +       return CACHEDIR;
112 +#else
113 +       return lp_lockdir();
114 +#endif
115 +}
116 diff -uNr samba-3.0.0beta2.orig/source/groupdb/mapping.c samba-3.0.0beta2/source/groupdb/mapping.c
117 --- samba-3.0.0beta2.orig/source/groupdb/mapping.c      2003-07-02 23:26:47.000000000 -0500
118 +++ samba-3.0.0beta2/source/groupdb/mapping.c   2003-07-02 23:19:02.000000000 -0500
119 @@ -134,7 +134,7 @@
120         
121         if (tdb && local_pid == sys_getpid())
122                 return True;
123 -       tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
124 +       tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
125         if (!tdb) {
126                 DEBUG(0,("Failed to open group mapping database\n"));
127                 return False;
128 diff -uNr samba-3.0.0beta2.orig/source/include/dynconfig.h samba-3.0.0beta2/source/include/dynconfig.h
129 --- samba-3.0.0beta2.orig/source/include/dynconfig.h    2003-07-02 23:26:47.000000000 -0500
130 +++ samba-3.0.0beta2/source/include/dynconfig.h 2003-07-02 23:19:02.000000000 -0500
131 @@ -31,8 +31,12 @@
132  extern pstring dyn_CONFIGFILE;
133  extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
134  extern pstring dyn_LIBDIR;
135 +extern pstring dyn_CODEPAGEDIR;
136  extern const fstring dyn_SHLIBEXT;
137  extern const pstring dyn_LOCKDIR; 
138  extern const pstring dyn_PIDDIR;
139  extern const pstring dyn_SMB_PASSWD_FILE;
140  extern const pstring dyn_PRIVATE_DIR;
141 +
142 +char *dyn_STATEDIR(void);
143 +char *dyn_CACHEDIR(void);
144 diff -uNr samba-3.0.0beta2.orig/source/intl/lang_tdb.c samba-3.0.0beta2/source/intl/lang_tdb.c
145 --- samba-3.0.0beta2.orig/source/intl/lang_tdb.c        2003-07-02 23:26:47.000000000 -0500
146 +++ samba-3.0.0beta2/source/intl/lang_tdb.c     2003-07-02 23:19:02.000000000 -0500
147 @@ -123,7 +123,7 @@
148         /* if no lang then we don't translate */
149         if (!lang) return True;
150  
151 -       asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
152 +       asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
153         if (stat(msg_path, &st) != 0) {
154                 /* the msg file isn't available */
155                 free(msg_path);
156 @@ -131,7 +131,7 @@
157         }
158         
159  
160 -       asprintf(&path, "%s%s.tdb", lock_path("lang_"), lang);
161 +       asprintf(&path, "%s%s.tdb", state_path("lang_"), lang);
162  
163         tdb = tdb_open_log(path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644);
164         if (!tdb) {
165 diff -uNr samba-3.0.0beta2.orig/source/lib/account_pol.c samba-3.0.0beta2/source/lib/account_pol.c
166 --- samba-3.0.0beta2.orig/source/lib/account_pol.c      2003-07-02 23:26:47.000000000 -0500
167 +++ samba-3.0.0beta2/source/lib/account_pol.c   2003-07-02 23:19:02.000000000 -0500
168 @@ -36,7 +36,7 @@
169  
170         if (tdb && local_pid == sys_getpid())
171                 return True;
172 -       tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
173 +       tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
174         if (!tdb) {
175                 DEBUG(0,("Failed to open account policy database\n"));
176                 return False;
177 diff -uNr samba-3.0.0beta2.orig/source/lib/util.c samba-3.0.0beta2/source/lib/util.c
178 --- samba-3.0.0beta2.orig/source/lib/util.c     2003-07-02 23:26:47.000000000 -0500
179 +++ samba-3.0.0beta2/source/lib/util.c  2003-07-02 23:19:02.000000000 -0500
180 @@ -2190,6 +2190,61 @@
181  }
182  
183  /**
184 + * @brief Returns an absolute path to a file in the Samba data directory.
185 + *
186 + * @param name File to find, relative to CODEPAGEDIR.
187 + *
188 + * @retval Pointer to a static #pstring containing the full path.
189 + **/
190 +
191 +char *data_path(const char *name)
192 +{
193 +       static pstring fname;
194 +       snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
195 +       return fname;
196 +}
197 +
198 +/*****************************************************************
199 +a useful function for returning a path in the Samba state directory
200 + *****************************************************************/
201 +char *state_path(char *name)
202 +{
203 +       static pstring fname;
204 +
205 +       pstrcpy(fname,dyn_STATEDIR());
206 +       trim_string(fname,"","/");
207 +
208 +       if (!directory_exist(fname,NULL)) {
209 +               mkdir(fname,0755);
210 +       }
211 +
212 +       pstrcat(fname,"/");
213 +       pstrcat(fname,name);
214 +
215 +       return fname;
216 +}
217 +
218 +/*****************************************************************
219 +a useful function for returning a path in the Samba cache directory
220 + *****************************************************************/
221 +char *cache_path(char *name)
222 +{
223 +       static pstring fname;
224 +
225 +       pstrcpy(fname,dyn_CACHEDIR());
226 +       trim_string(fname,"","/");
227 +
228 +       if (!directory_exist(fname,NULL)) {
229 +                       mkdir(fname,0755);
230 +       }
231 +
232 +       pstrcat(fname,"/");
233 +       pstrcat(fname,name);
234 +
235 +       return fname;
236 +}
237 +
238 +/**
239   * @brief Returns the platform specific shared library extension.
240   *
241   * @retval Pointer to a static #fstring containing the extension.
242 diff -uNr samba-3.0.0beta2.orig/source/lib/util_unistr.c samba-3.0.0beta2/source/lib/util_unistr.c
243 --- samba-3.0.0beta2.orig/source/lib/util_unistr.c      2003-07-02 23:26:47.000000000 -0500
244 +++ samba-3.0.0beta2/source/lib/util_unistr.c   2003-07-02 23:19:02.000000000 -0500
245 @@ -54,8 +54,8 @@
246         if (initialised) return;
247         initialised = 1;
248  
249 -       upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
250 -       lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
251 +       upcase_table = map_file(data_path("upcase.dat"), 0x20000);
252 +       lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
253  
254         /* we would like Samba to limp along even if these tables are
255            not available */
256 @@ -161,7 +161,7 @@
257                 return;
258         }
259  
260 -       valid_file = map_file(lib_path("valid.dat"), 0x10000);
261 +       valid_file = map_file(data_path("valid.dat"), 0x10000);
262         if (valid_file) {
263                 valid_table = valid_file;
264                 mapped_file = 1;
265 diff -uNr samba-3.0.0beta2.orig/source/libsmb/samlogon_cache.c samba-3.0.0beta2/source/libsmb/samlogon_cache.c
266 --- samba-3.0.0beta2.orig/source/libsmb/samlogon_cache.c        2003-07-01 09:40:37.000000000 -0500
267 +++ samba-3.0.0beta2/source/libsmb/samlogon_cache.c     2003-07-02 23:19:02.000000000 -0500
268 @@ -34,7 +34,7 @@
269  BOOL netsamlogon_cache_init(void)
270  {
271         if (!netsamlogon_tdb) {
272 -               netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
273 +               netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
274                                                    TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
275         }
276  
277 @@ -67,7 +67,7 @@
278             winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
279  
280         if (!tdb) {
281 -               tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,
282 +               tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000,
283                                    TDB_DEFAULT, O_RDWR, 0600);
284                 if (!tdb) {
285                         DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n"));
286 --- samba_3_0/source/nmbd/nmbd_serverlistdb.c.orig      2003-09-08 10:53:13.000000000 -0400
287 +++ samba_3_0/source/nmbd/nmbd_serverlistdb.c   2003-09-08 11:22:03.000000000 -0400
288 @@ -327,7 +327,7 @@
289  
290         updatecount++;
291      
292 -       pstrcpy(fname,lp_lockdir());
293 +       pstrcpy(fname,dyn_CACHEDIR());
294         trim_char(fname,'\0' ,'/');
295         pstrcat(fname,"/");
296         pstrcat(fname,SERVER_LIST);
297 --- samba-3.0.0rc2/source/nmbd/nmbd_winsserver.c.orig   2003-08-28 17:42:44.000000000 -0400
298 +++ samba-3.0.0rc2/source/nmbd/nmbd_winsserver.c        2003-08-31 08:09:11.000000000 -0400
299 @@ -228,7 +228,7 @@
300  
301         add_samba_names_to_subnet(wins_server_subnet);
302  
303 -       if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
304 +       if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
305                 DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
306                         WINS_LIST, strerror(errno) ));
307                 return True;
308 @@ -1759,7 +1759,7 @@
309                 }
310         }
311  
312 -       slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
313 +       slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
314         all_string_sub(fname,"//", "/", 0);
315         slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
316  
317 diff -uNr samba-3.0.0beta2.orig/source/nsswitch/winbindd_cache.c samba-3.0.0beta2/source/nsswitch/winbindd_cache.c
318 --- samba-3.0.0beta2.orig/source/nsswitch/winbindd_cache.c      2003-07-02 23:26:47.000000000 -0500
319 +++ samba-3.0.0beta2/source/nsswitch/winbindd_cache.c   2003-07-02 23:19:02.000000000 -0500
320 @@ -56,7 +56,7 @@
321         if (opt_nocache)
322                 return;
323  
324 -       wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000, 
325 +       wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000, 
326                                    TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0600);
327  
328         if (!wcache->tdb) {
329 diff -uNr samba-3.0.0beta2.orig/source/nsswitch/winbindd_util.c samba-3.0.0beta2/source/nsswitch/winbindd_util.c
330 --- samba-3.0.0beta2.orig/source/nsswitch/winbindd_util.c       2003-07-01 15:44:25.000000000 -0500
331 +++ samba-3.0.0beta2/source/nsswitch/winbindd_util.c    2003-07-02 23:19:02.000000000 -0500
332 @@ -813,7 +813,7 @@
333         SMB_STRUCT_STAT stbuf;
334         TDB_CONTEXT *idmap_tdb;
335  
336 -       pstrcpy(idmap_name, lock_path("winbindd_idmap.tdb"));
337 +       pstrcpy(idmap_name, state_path("winbindd_idmap.tdb"));
338  
339         if (!file_exist(idmap_name, &stbuf)) {
340                 /* nothing to convert return */
341 diff -uNr samba-3.0.0beta2.orig/source/param/loadparm.c samba-3.0.0beta2/source/param/loadparm.c
342 --- samba-3.0.0beta2.orig/source/param/loadparm.c       2003-07-02 23:26:47.000000000 -0500
343 +++ samba-3.0.0beta2/source/param/loadparm.c    2003-07-02 23:19:02.000000000 -0500
344 @@ -104,6 +104,9 @@
345         char *szAddPrinterCommand;
346         char *szDeletePrinterCommand;
347         char *szOs2DriverMap;
348 +#ifdef FHS_COMPATIBLE
349 +       char *szLockDirStub;
350 +#endif
351         char *szLockDir;
352         char *szPidDir;
353         char *szRootdir;
354 @@ -1083,8 +1083,13 @@
355         {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, 
356         {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
357         {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
358 +#ifdef FHS_COMPATIBLE
359 +       {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0}, 
360 +       {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
361 +#else
362         {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED}, 
363         {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE}, 
364 +#endif
365         {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED}, 
366  #ifdef WITH_UTMP
367         {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, 
368 diff -uNr samba-3.0.0beta2.orig/source/passdb/pdb_tdb.c samba-3.0.0beta2/source/passdb/pdb_tdb.c
369 --- samba-3.0.0beta2.orig/source/passdb/pdb_tdb.c       2003-07-02 23:26:47.000000000 -0500
370 +++ samba-3.0.0beta2/source/passdb/pdb_tdb.c    2003-07-02 23:19:02.000000000 -0500
371 @@ -501,10 +501,7 @@
372         if (location) {
373                 tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, location);
374         } else {
375 -               pstring tdbfile;
376 -               get_private_directory(tdbfile);
377 -               pstrcat(tdbfile, "/");
378 -               pstrcat(tdbfile, PASSDB_FILE_NAME);
379 +               char *tdbfile = state_path(PASSDB_FILE_NAME);
380                 tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, tdbfile);
381         }
382  
383 diff -uNr samba-3.0.0beta2.orig/source/passdb/secrets.c samba-3.0.0beta2/source/passdb/secrets.c
384 --- samba-3.0.0beta2.orig/source/passdb/secrets.c       2003-07-02 23:26:47.000000000 -0500
385 +++ samba-3.0.0beta2/source/passdb/secrets.c    2003-07-02 23:19:02.000000000 -0500
386 @@ -37,8 +37,7 @@
387         if (tdb)
388                 return True;
389  
390 -       pstrcpy(fname, lp_private_dir());
391 -       pstrcat(fname,"/secrets.tdb");
392 +       pstrcpy(fname, state_path("secrets.tdb"));
393  
394         tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
395  
396 diff -uNr samba-3.0.0beta2.orig/source/printing/nt_printing.c samba-3.0.0beta2/source/printing/nt_printing.c
397 --- samba-3.0.0beta2.orig/source/printing/nt_printing.c 2003-07-02 23:26:47.000000000 -0500
398 +++ samba-3.0.0beta2/source/printing/nt_printing.c      2003-07-02 23:19:02.000000000 -0500
399 @@ -293,28 +293,28 @@
400   
401         if (tdb_drivers)
402                 tdb_close(tdb_drivers);
403 -       tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
404 +       tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
405         if (!tdb_drivers) {
406                 DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
407 -                       lock_path("ntdrivers.tdb"), strerror(errno) ));
408 +                       state_path("ntdrivers.tdb"), strerror(errno) ));
409                 return False;
410         }
411   
412         if (tdb_printers)
413                 tdb_close(tdb_printers);
414 -       tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
415 +       tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
416         if (!tdb_printers) {
417                 DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
418 -                       lock_path("ntprinters.tdb"), strerror(errno) ));
419 +                       state_path("ntprinters.tdb"), strerror(errno) ));
420                 return False;
421         }
422   
423         if (tdb_forms)
424                 tdb_close(tdb_forms);
425 -       tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
426 +       tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
427         if (!tdb_forms) {
428                 DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
429 -                       lock_path("ntforms.tdb"), strerror(errno) ));
430 +                       state_path("ntforms.tdb"), strerror(errno) ));
431                 return False;
432         }
433   
434 diff -uNr samba-3.0.0beta2.orig/source/printing/printing.c samba-3.0.0beta2/source/printing/printing.c
435 --- samba-3.0.0beta2.orig/source/printing/printing.c    2003-07-02 23:26:47.000000000 -0500
436 +++ samba-3.0.0beta2/source/printing/printing.c 2003-07-02 23:19:02.000000000 -0500
437 @@ -174,8 +174,8 @@
438         if (local_pid == sys_getpid())
439                 return True;
440  
441 -       unlink(lock_path("printing.tdb"));
442 -       pstrcpy(printing_path,lock_path("printing"));
443 +       unlink(cache_path("printing.tdb"));
444 +       pstrcpy(printing_path,cache_path("printing"));
445         mkdir(printing_path,0755);
446  
447         local_pid = sys_getpid();
448 diff -uNr samba-3.0.0beta2.orig/source/printing/printing_db.c samba-3.0.0beta2/source/printing/printing_db.c
449 --- samba-3.0.0beta2.orig/source/printing/printing_db.c 2003-07-02 23:26:47.000000000 -0500
450 +++ samba-3.0.0beta2/source/printing/printing_db.c      2003-07-02 23:19:02.000000000 -0500
451 @@ -86,7 +86,7 @@
452                 DLIST_ADD(print_db_head, p);
453         }
454  
455 -       pstrcpy(printdb_path, lock_path("printing/"));
456 +       pstrcpy(printdb_path, cache_path("printing/"));
457         pstrcat(printdb_path, printername);
458         pstrcat(printdb_path, ".tdb");
459  
460 diff -uNr samba-3.0.20b.orig/source/registry/reg_db.c samba-3.0.20b/source/registry/reg_db.c
461 --- samba-3.0.20b.orig/source/registry/reg_db.c 2003-07-02 23:26:47.000000000 -0500
462 +++ samba-3.0.20b/source/registry/reg_db.c      2003-07-02 23:19:02.000000000 -0500
463 @@ -198,13 +198,13 @@
464         if ( tdb_reg )
465                 return True;
466
467 -       if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
468 +       if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
469         {
470 -               tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
471 +               tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
472                 if ( !tdb_reg ) {
473                         DEBUG(0,("init_registry: Failed to open registry %s (%s)\n",
474 -                               lock_path("registry.tdb"), strerror(errno) ));
475 +                               state_path("registry.tdb"), strerror(errno) ));
476                         return False;
477                 }
478                 
479                 DEBUG(10,("init_registry: Successfully created registry tdb\n"));
480 diff -uNr samba-3.0.0beta2.orig/source/rpc_server/srv_srvsvc_nt.c samba-3.0.0beta2/source/rpc_server/srv_srvsvc_nt.c
481 --- samba-3.0.0beta2.orig/source/rpc_server/srv_srvsvc_nt.c     2003-07-02 23:26:47.000000000 -0500
482 +++ samba-3.0.0beta2/source/rpc_server/srv_srvsvc_nt.c  2003-07-02 23:19:02.000000000 -0500
483 @@ -133,10 +133,10 @@
484   
485         if (share_tdb && local_pid == sys_getpid())
486                 return True;
487 -       share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
488 +       share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
489         if (!share_tdb) {
490                 DEBUG(0,("Failed to open share info database %s (%s)\n",
491 -                       lock_path("share_info.tdb"), strerror(errno) ));
492 +                       state_path("share_info.tdb"), strerror(errno) ));
493                 return False;
494         }
495   
496 diff -uNr samba-3.0.0beta2.orig/source/sam/idmap_tdb.c samba-3.0.0beta2/source/sam/idmap_tdb.c
497 --- samba-3.0.0beta2.orig/source/sam/idmap_tdb.c        2003-07-01 15:44:26.000000000 -0500
498 +++ samba-3.0.0beta2/source/sam/idmap_tdb.c     2003-07-02 23:19:02.000000000 -0500
499 @@ -487,7 +487,7 @@
500         BOOL tdb_is_new = False;
501  
502         /* use the old database if present */
503 -       tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));
504 +       tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb"));
505         if (!tdbfile) {
506                 DEBUG(0, ("idmap_init: out of memory!\n"));
507                 return NT_STATUS_NO_MEMORY;
508 diff -uNr samba-3.0.0beta2.orig/source/smbd/lanman.c samba-3.0.0beta2/source/smbd/lanman.c
509 --- samba-3.0.0beta2.orig/source/smbd/lanman.c  2003-07-02 23:26:47.000000000 -0500
510 +++ samba-3.0.0beta2/source/smbd/lanman.c       2003-07-02 23:19:02.000000000 -0500
511 @@ -966,9 +966,9 @@
512    BOOL local_list_only;
513    int i;
514  
515 -  lines = file_lines_load(lock_path(SERVER_LIST), NULL);
516 +  lines = file_lines_load(cache_path(SERVER_LIST), NULL);
517    if (!lines) {
518 -    DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
519 +    DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
520      return(0);
521    }
522  
523 diff -uNr samba-3.0.0beta2.orig/source/wrepld/process.c samba-3.0.0beta2/source/wrepld/process.c
524 --- samba-3.0.0beta2.orig/source/wrepld/process.c       2003-07-02 23:26:47.000000000 -0500
525 +++ samba-3.0.0beta2/source/wrepld/process.c    2003-07-02 23:19:02.000000000 -0500
526 @@ -197,7 +197,7 @@
527  {
528         TDB_CONTEXT *tdb;
529  
530 -       tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
531 +       tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
532         if (!tdb) {
533                 DEBUG(2,("get_our_last_id: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
534                 return;
535 @@ -489,7 +489,7 @@
536                 }
537  
538  
539 -       tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
540 +       tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
541         if (!tdb) {
542                 DEBUG(2,("send_entry_request: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
543                 return;