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