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