diff -uPr samba-3.0.24.old/source/configure.in samba-3.0.24.new/source/configure.in --- samba-3.0.24.old/source/configure.in 2007-02-04 13:59:28.000000000 -0500 +++ samba-3.0.24.new/source/configure.in 2007-03-06 15:16:27.000000000 -0500 @@ -23,7 +23,8 @@ AC_PREFIX_DEFAULT(/usr/local/samba) rootsbindir="\${SBINDIR}" -lockdir="\${VARDIR}/locks" +cachedir="\${VARDIR}/locks" +statedir="\${VARDIR}/locks" piddir="\${VARDIR}/locks" test "${mandir}" || mandir="\${prefix}/man" logfilebase="\${VARDIR}" @@ -37,7 +38,8 @@ [ --with-fhs Use FHS-compliant paths (default=no)], [ case "$withval" in yes) - lockdir="\${VARDIR}/lib/samba" + cachedir="\${VARDIR}/cache/samba" + statedir="\${VARDIR}/lib/samba" piddir="\${VARDIR}/run" mandir="\${prefix}/share/man" logfilebase="\${VARDIR}/log/samba" @@ -81,18 +83,34 @@ esac]) ################################################# -# set lock directory location -AC_ARG_WITH(lockdir, -[ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)], +# set cache directory location +AC_ARG_WITH(cachedir, +[ --with-cachedir=DIR Where to put persistent files ($ac_default_prefix/var/locks)], [ case "$withval" in yes|no) # # Just in case anybody calls it without argument # - AC_MSG_WARN([--with-lockdir called without argument - will use default]) + AC_MSG_WARN([--with-cachedir called without argument - will use default]) ;; * ) - lockdir="$withval" + cachedir="$withval" + ;; + esac]) + +################################################# +# set state directory location +AC_ARG_WITH(statedir, +[ --with-statedir=DIR Where to put persistent files ($ac_default_prefix/var/locks)], +[ case "$withval" in + yes|no) + # + # Just in case anybody calls it without argument + # + AC_MSG_WARN([--with-statedir called without argument - will use default]) + ;; + * ) + statedir="$withval" ;; esac]) @@ -228,7 +246,8 @@ ]) AC_SUBST(configdir) -AC_SUBST(lockdir) +AC_SUBST(cachedir) +AC_SUBST(statedir) AC_SUBST(piddir) AC_SUBST(logfilebase) AC_SUBST(privatedir) diff -uPr samba-3.0.24.old/source/dynconfig.c samba-3.0.24.new/source/dynconfig.c --- samba-3.0.24.old/source/dynconfig.c 2007-02-04 13:59:28.000000000 -0500 +++ samba-3.0.24.new/source/dynconfig.c 2007-03-06 15:31:22.000000000 -0500 @@ -65,7 +65,8 @@ * * Not writable, but used to set a default in the parameter table. **/ -pstring dyn_LOCKDIR = LOCKDIR; +pstring dyn_STATEDIR = STATEDIR; +pstring dyn_CACHEDIR = CACHEDIR; pstring dyn_PIDDIR = PIDDIR; pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE; diff -uPr samba-3.0.24.old/source/groupdb/mapping.c samba-3.0.24.new/source/groupdb/mapping.c --- samba-3.0.24.old/source/groupdb/mapping.c 2007-02-04 13:59:14.000000000 -0500 +++ samba-3.0.24.new/source/groupdb/mapping.c 2007-03-06 15:55:49.000000000 -0500 @@ -56,7 +56,7 @@ if (tdb) return True; - tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open group mapping database\n")); return False; diff -uPr samba-3.0.24.old/source/include/dynconfig.h samba-3.0.24.new/source/include/dynconfig.h --- samba-3.0.24.old/source/include/dynconfig.h 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/include/dynconfig.h 2007-03-06 15:53:36.000000000 -0500 @@ -32,7 +32,8 @@ extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE; extern pstring dyn_LIBDIR; extern fstring dyn_SHLIBEXT; -extern pstring dyn_LOCKDIR; +extern pstring dyn_CACHEDIR; +extern pstring dyn_STATEDIR; extern pstring dyn_PIDDIR; extern pstring dyn_SMB_PASSWD_FILE; extern pstring dyn_PRIVATE_DIR; diff -uPr samba-3.0.24.old/source/intl/lang_tdb.c samba-3.0.24.new/source/intl/lang_tdb.c --- samba-3.0.24.old/source/intl/lang_tdb.c 2006-04-19 22:29:23.000000000 -0400 +++ samba-3.0.24.new/source/intl/lang_tdb.c 2007-03-06 15:56:14.000000000 -0500 @@ -139,7 +139,7 @@ goto done; } - asprintf(&path, "%s%s.tdb", lock_path("lang_"), lang); + asprintf(&path, "%s%s.tdb", state_path("lang_"), lang); DEBUG(10, ("lang_tdb_init: loading %s\n", path)); diff -uPr samba-3.0.24.old/source/lib/account_pol.c samba-3.0.24.new/source/lib/account_pol.c --- samba-3.0.24.old/source/lib/account_pol.c 2007-02-04 13:59:18.000000000 -0500 +++ samba-3.0.24.new/source/lib/account_pol.c 2007-03-06 15:56:23.000000000 -0500 @@ -262,7 +262,7 @@ return True; } - tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open account policy database\n")); return False; diff -uPr samba-3.0.24.old/source/lib/gencache.c samba-3.0.24.new/source/lib/gencache.c --- samba-3.0.24.old/source/lib/gencache.c 2007-02-04 13:59:17.000000000 -0500 +++ samba-3.0.24.new/source/lib/gencache.c 2007-03-06 15:56:34.000000000 -0500 @@ -56,7 +56,7 @@ /* skip file open if it's already opened */ if (cache) return True; - cache_fname = lock_path("gencache.tdb"); + cache_fname = cache_path("gencache.tdb"); DEBUG(5, ("Opening cache file at %s\n", cache_fname)); diff -uPr samba-3.0.24.old/source/lib/messages.c samba-3.0.24.new/source/lib/messages.c --- samba-3.0.24.old/source/lib/messages.c 2007-02-04 13:59:18.000000000 -0500 +++ samba-3.0.24.new/source/lib/messages.c 2007-03-06 15:56:43.000000000 -0500 @@ -119,7 +119,7 @@ { if (tdb) return True; - tdb = tdb_open_log(lock_path("messages.tdb"), + tdb = tdb_open_log(cache_path("messages.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR|O_CREAT,0600); diff -uPr samba-3.0.24.old/source/lib/popt_common.c samba-3.0.24.new/source/lib/popt_common.c --- samba-3.0.24.old/source/lib/popt_common.c 2007-02-04 13:59:17.000000000 -0500 +++ samba-3.0.24.new/source/lib/popt_common.c 2007-03-06 15:38:15.000000000 -0500 @@ -156,6 +156,8 @@ * --lmhostsfile * --libdir * --shlibext + * --statedir + * --cachedir * --lockdir * --piddir * --smb-passwd-file @@ -169,6 +171,8 @@ DYN_LMHOSTSFILE, DYN_LIBDIR, DYN_SHLIBEXT, + DYN_STATEDIR, + DYN_CACHEDIR, DYN_LOCKDIR, DYN_PIDDIR, DYN_SMB_PASSWD_FILE, @@ -219,9 +223,22 @@ } break; + case DYN_STATEDIR: + if (arg) { + pstrcpy(dyn_STATEDIR, arg); + } + break; + + case DYN_CACHEDIR: + if (arg) { + pstrcpy(dyn_CACHEDIR, arg); + } + break; + case DYN_LOCKDIR: if (arg) { - pstrcpy(dyn_LOCKDIR, arg); + pstrcpy(dyn_STATEDIR, arg); + pstrcpy(dyn_CACHEDIR, arg); } break; @@ -262,8 +279,12 @@ "Path to shared library directory", "LIBDIR" }, { "shlibext", '\0' , POPT_ARG_STRING, NULL, DYN_SHLIBEXT, "Shared library extension", "SHLIBEXT" }, + { "statedir", '\0' , POPT_ARG_STRING, NULL, DYN_STATEDIR, + "Path to state file directory", "STATEDIR" }, + { "cachedir", '\0' , POPT_ARG_STRING, NULL, DYN_CACHEDIR, + "Path to cache file directory", "CACHEDIR" }, { "lockdir", '\0' , POPT_ARG_STRING, NULL, DYN_LOCKDIR, - "Path to lock file directory", "LOCKDIR" }, + "Path to lock(cache and state) file directory", "LOCKDIR" }, { "piddir", '\0' , POPT_ARG_STRING, NULL, DYN_PIDDIR, "Path to PID file directory", "PIDDIR" }, { "smb-passwd-file", '\0' , POPT_ARG_STRING, NULL, DYN_SMB_PASSWD_FILE, diff -uPr samba-3.0.24.old/source/lib/sharesec.c samba-3.0.24.new/source/lib/sharesec.c --- samba-3.0.24.old/source/lib/sharesec.c 2006-04-19 22:29:23.000000000 -0400 +++ samba-3.0.24.new/source/lib/sharesec.c 2007-03-06 15:56:59.000000000 -0500 @@ -47,10 +47,10 @@ return True; } - share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!share_tdb) { DEBUG(0,("Failed to open share info database %s (%s)\n", - lock_path("share_info.tdb"), strerror(errno) )); + state_path("share_info.tdb"), strerror(errno) )); return False; } diff -uPr samba-3.0.24.old/source/lib/util.c samba-3.0.24.new/source/lib/util.c --- samba-3.0.24.old/source/lib/util.c 2007-02-04 13:59:17.000000000 -0500 +++ samba-3.0.24.new/source/lib/util.c 2007-03-06 15:55:29.000000000 -0500 @@ -2519,14 +2519,34 @@ } /***************************************************************** - A useful function for returning a path in the Samba lock directory. + A useful function for returning a path in the Samba cache directory. *****************************************************************/ -char *lock_path(const char *name) +char *cache_path(const char *name) { static pstring fname; - pstrcpy(fname,lp_lockdir()); + pstrcpy(fname,lp_cachedir()); + trim_char(fname,'\0','/'); + + if (!directory_exist(fname,NULL)) + mkdir(fname,0755); + + pstrcat(fname,"/"); + pstrcat(fname,name); + + return fname; +} + +/***************************************************************** + A useful function for returning a path in the Samba state directory. +*****************************************************************/ + +char *state_path(const char *name) +{ + static pstring fname; + + pstrcpy(fname,lp_statedir()); trim_char(fname,'\0','/'); if (!directory_exist(fname,NULL)) diff -uPr samba-3.0.24.old/source/libsmb/gpo.c samba-3.0.24.new/source/libsmb/gpo.c --- samba-3.0.24.old/source/libsmb/gpo.c 2006-04-19 22:29:25.000000000 -0400 +++ samba-3.0.24.new/source/libsmb/gpo.c 2007-03-06 15:57:10.000000000 -0500 @@ -76,7 +76,7 @@ return NT_STATUS_NO_MEMORY; } - local_file = talloc_asprintf(mem_ctx, "%s/%s", lock_path("gpo_cache"), "gpt.ini"); + local_file = talloc_asprintf(mem_ctx, "%s/%s", cache_path("gpo_cache"), "gpt.ini"); if (local_file == NULL) { return NT_STATUS_NO_MEMORY; } diff -uPr samba-3.0.24.old/source/libsmb/samlogon_cache.c samba-3.0.24.new/source/libsmb/samlogon_cache.c --- samba-3.0.24.old/source/libsmb/samlogon_cache.c 2007-02-04 13:59:20.000000000 -0500 +++ samba-3.0.24.new/source/libsmb/samlogon_cache.c 2007-03-06 15:57:27.000000000 -0500 @@ -34,7 +34,7 @@ BOOL netsamlogon_cache_init(void) { if (!netsamlogon_tdb) { - netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0, + netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0600); } @@ -67,7 +67,7 @@ winbindd_cache.tdb open. Open the tdb if a NULL is passed. */ if (!tdb) { - tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000, + tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000, TDB_DEFAULT, O_RDWR, 0600); if (!tdb) { DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n")); diff -uPr samba-3.0.24.old/source/libsmb/unexpected.c samba-3.0.24.new/source/libsmb/unexpected.c --- samba-3.0.24.old/source/libsmb/unexpected.c 2005-02-25 12:59:32.000000000 -0500 +++ samba-3.0.24.new/source/libsmb/unexpected.c 2007-03-06 15:57:43.000000000 -0500 @@ -46,7 +46,7 @@ int len=0; if (!tdbd) { - tdbd = tdb_open_log(lock_path("unexpected.tdb"), 0, + tdbd = tdb_open_log(cache_path("unexpected.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); if (!tdbd) { @@ -148,7 +148,7 @@ { TDB_CONTEXT *tdb2; - tdb2 = tdb_open_log(lock_path("unexpected.tdb"), 0, 0, O_RDONLY, 0); + tdb2 = tdb_open_log(cache_path("unexpected.tdb"), 0, 0, O_RDONLY, 0); if (!tdb2) return NULL; matched_packet = NULL; diff -uPr samba-3.0.24.old/source/locking/brlock.c samba-3.0.24.new/source/locking/brlock.c --- samba-3.0.24.old/source/locking/brlock.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/locking/brlock.c 2007-03-06 15:58:11.000000000 -0500 @@ -270,13 +270,13 @@ if (tdb) { return; } - tdb = tdb_open_log(lock_path("brlock.tdb"), + tdb = tdb_open_log(cache_path("brlock.tdb"), lp_open_files_db_hash_size(), TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST), read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 ); if (!tdb) { DEBUG(0,("Failed to open byte range locking database %s\n", - lock_path("brlock.tdb"))); + cache_path("brlock.tdb"))); return; } } diff -uPr samba-3.0.24.old/source/locking/locking.c samba-3.0.24.new/source/locking/locking.c --- samba-3.0.24.old/source/locking/locking.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/locking/locking.c 2007-03-06 15:58:19.000000000 -0500 @@ -369,7 +369,7 @@ if (tdb) return True; - tdb = tdb_open_log(lock_path("locking.tdb"), + tdb = tdb_open_log(cache_path("locking.tdb"), lp_open_files_db_hash_size(), TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST), read_only?O_RDONLY:O_RDWR|O_CREAT, diff -uPr samba-3.0.24.old/source/Makefile.in samba-3.0.24.new/source/Makefile.in --- samba-3.0.24.old/source/Makefile.in 2007-02-04 13:59:28.000000000 -0500 +++ samba-3.0.24.new/source/Makefile.in 2007-03-06 15:40:03.000000000 -0500 @@ -98,7 +98,8 @@ SWATDIR = @swatdir@ # the directory where lock files go -LOCKDIR = @lockdir@ +STATEDIR = @statedir@ +CACHEDIR = @cachedir@ # the directory where pid files go PIDDIR = @piddir@ @@ -126,7 +127,7 @@ PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" -DDRIVERFILE=\"$(DRIVERFILE)\" PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" -PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" +PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DSTATEDIR=\"$(STATEDIR)\" -DCACHEDIR=\"$(CACHEEDIR)\" -DPIDDIR=\"$(PIDDIR)\" PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \ -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" @@ -1437,7 +1438,7 @@ # is not used installdirs: - @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR) + @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(STATEDIR) $(CACHEDIR) $(MANDIR) installservers: all installdirs @$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(SBINDIR) $(SBIN_PROGS) @@ -1549,7 +1550,8 @@ @echo " mandir: $(MANDIR)" @echo " privatedir: $(PRIVATE_DIR)" @echo " configdir: $(CONFIGDIR)" - @echo " lockdir: $(LOCKDIR)" + @echo " statedir: $(STATEDIR)" + @echo " cachedir: $(CACHEDIR)" @echo " piddir: $(PIDDIR)" @echo " swatdir: $(SWATDIR)" diff -uPr samba-3.0.24.old/source/nmbd/nmbd.c samba-3.0.24.new/source/nmbd/nmbd.c --- samba-3.0.24.old/source/nmbd/nmbd.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/nmbd/nmbd.c 2007-03-06 15:21:15.000000000 -0500 @@ -741,8 +741,8 @@ } #endif - if (!directory_exist(lp_lockdir(), NULL)) { - mkdir(lp_lockdir(), 0755); + if (!directory_exist(lp_statedir(), NULL)) { + mkdir(lp_statedir(), 0755); } pidfile_create("nmbd"); diff -uPr samba-3.0.24.old/source/nmbd/nmbd_namelistdb.c samba-3.0.24.new/source/nmbd/nmbd_namelistdb.c --- samba-3.0.24.old/source/nmbd/nmbd_namelistdb.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/nmbd/nmbd_namelistdb.c 2007-03-06 15:58:37.000000000 -0500 @@ -626,7 +626,7 @@ XFILE *fp; struct subnet_record *subrec; - fp = x_fopen(lock_path("namelist.debug"),O_WRONLY|O_CREAT|O_TRUNC, 0644); + fp = x_fopen(cache_path("namelist.debug"),O_WRONLY|O_CREAT|O_TRUNC, 0644); if (!fp) { DEBUG(0,("dump_all_namelists: Can't open file %s. Error was %s\n", diff -uPr samba-3.0.24.old/source/nmbd/nmbd_processlogon.c samba-3.0.24.new/source/nmbd/nmbd_processlogon.c --- samba-3.0.24.old/source/nmbd/nmbd_processlogon.c 2005-02-25 12:59:38.000000000 -0500 +++ samba-3.0.24.new/source/nmbd/nmbd_processlogon.c 2007-03-06 15:58:56.000000000 -0500 @@ -40,7 +40,7 @@ { TDB_CONTEXT *tdb; - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (!tdb) { diff -uPr samba-3.0.24.old/source/nmbd/nmbd_serverlistdb.c samba-3.0.24.new/source/nmbd/nmbd_serverlistdb.c --- samba-3.0.24.old/source/nmbd/nmbd_serverlistdb.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/nmbd/nmbd_serverlistdb.c 2007-03-06 15:21:25.000000000 -0500 @@ -325,7 +325,7 @@ updatecount++; - pstrcpy(fname,lp_lockdir()); + pstrcpy(fname,lp_statedir()); trim_char(fname,'\0' ,'/'); pstrcat(fname,"/"); pstrcat(fname,SERVER_LIST); diff -uPr samba-3.0.24.old/source/nmbd/nmbd_synclists.c samba-3.0.24.new/source/nmbd/nmbd_synclists.c --- samba-3.0.24.old/source/nmbd/nmbd_synclists.c 2005-10-17 22:45:04.000000000 -0400 +++ samba-3.0.24.new/source/nmbd/nmbd_synclists.c 2007-03-06 15:21:33.000000000 -0500 @@ -154,7 +154,7 @@ s->ip = ip; slprintf(s->fname, sizeof(pstring)-1, - "%s/sync.%d", lp_lockdir(), counter++); + "%s/sync.%d", lp_statedir(), counter++); all_string_sub(s->fname,"//", "/", 0); DLIST_ADD(syncs, s); diff -uPr samba-3.0.24.old/source/nmbd/nmbd_winsserver.c samba-3.0.24.new/source/nmbd/nmbd_winsserver.c --- samba-3.0.24.old/source/nmbd/nmbd_winsserver.c 2007-02-04 13:59:23.000000000 -0500 +++ samba-3.0.24.new/source/nmbd/nmbd_winsserver.c 2007-03-06 15:59:13.000000000 -0500 @@ -574,7 +574,7 @@ } /* Open the wins.tdb. */ - wins_tdb = tdb_open_log(lock_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600); + wins_tdb = tdb_open_log(state_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600); if (!wins_tdb) { DEBUG(0,("initialise_wins: failed to open wins.tdb. Error was %s\n", strerror(errno) )); @@ -585,7 +585,7 @@ add_samba_names_to_subnet(wins_server_subnet); - if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) { + if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) { DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) )); return True; @@ -2337,7 +2337,7 @@ } } - slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST); + slprintf(fname,sizeof(fname)-1,"%s/%s", lp_statedir(), WINS_LIST); all_string_sub(fname,"//", "/", 0); slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid()); diff -uPr samba-3.0.24.old/source/nsswitch/winbindd_cache.c samba-3.0.24.new/source/nsswitch/winbindd_cache.c --- samba-3.0.24.old/source/nsswitch/winbindd_cache.c 2007-02-04 13:59:14.000000000 -0500 +++ samba-3.0.24.new/source/nsswitch/winbindd_cache.c 2007-03-06 15:59:32.000000000 -0500 @@ -1942,7 +1942,7 @@ return True; /* when working offline we must not clear the cache on restart */ - wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), + wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), O_RDWR|O_CREAT, 0600); @@ -2186,7 +2186,7 @@ return; /* when working offline we must not clear the cache on restart */ - wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), + wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, lp_winbind_offline_logon() ? TDB_DEFAULT : (TDB_DEFAULT | TDB_CLEAR_IF_FIRST), O_RDWR|O_CREAT, 0600); diff -uPr samba-3.0.24.old/source/nsswitch/winbindd_util.c samba-3.0.24.new/source/nsswitch/winbindd_util.c --- samba-3.0.24.old/source/nsswitch/winbindd_util.c 2007-02-04 13:59:14.000000000 -0500 +++ samba-3.0.24.new/source/nsswitch/winbindd_util.c 2007-03-06 15:59:59.000000000 -0500 @@ -911,7 +911,7 @@ char *get_winbind_priv_pipe_dir(void) { - return lock_path(WINBINDD_PRIV_SOCKET_SUBDIR); + return state_path(WINBINDD_PRIV_SOCKET_SUBDIR); } /* Open the winbindd socket */ @@ -1182,7 +1182,7 @@ SMB_STRUCT_STAT stbuf; TDB_CONTEXT *idmap_tdb; - pstrcpy(idmap_name, lock_path("winbindd_idmap.tdb")); + pstrcpy(idmap_name, state_path("winbindd_idmap.tdb")); if (!file_exist(idmap_name, &stbuf)) { /* nothing to convert return */ diff -uPr samba-3.0.24.old/source/param/loadparm.c samba-3.0.24.new/source/param/loadparm.c --- samba-3.0.24.old/source/param/loadparm.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/param/loadparm.c 2007-03-06 15:52:22.000000000 -0500 @@ -107,7 +107,8 @@ char *szAddPrinterCommand; char *szDeletePrinterCommand; char *szOs2DriverMap; - char *szLockDir; + char *szCacheDir; + char *szStateDir; char *szPidDir; char *szRootdir; char *szDefaultService; @@ -621,6 +622,7 @@ static BOOL handle_netbios_scope( int snum, const char *pszParmValue, char **ptr ); static BOOL handle_charset( int snum, const char *pszParmValue, char **ptr ); static BOOL handle_printing( int snum, const char *pszParmValue, char **ptr); +static BOOL handle_lock_dir( int snum, const char *pszParmValue, char **ptr); static void set_server_role(void); static void set_default_server_announce_type(void); @@ -1186,8 +1188,10 @@ {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, - {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED}, - {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE}, + {"cache directory", P_STRING, P_GLOBAL, &Globals.szCacheDir, NULL, NULL, FLAG_ADVANCED}, + {"state directory", P_STRING, P_GLOBAL, &Globals.szStateDir, NULL, NULL, FLAG_ADVANCED}, + {"lock directory", P_STRING, P_GLOBAL, &Globals.szCacheDir, handle_lock_dir, NULL, FLAG_HIDE | FLAG_DEPRECATED}, + {"lock dir", P_STRING, P_GLOBAL, &Globals.szCacheDir, NULL, NULL, FLAG_HIDE | FLAG_DEPRECATED }, {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED}, #ifdef WITH_UTMP {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED}, @@ -1445,7 +1449,8 @@ string_set(&Globals.szPasswdProgram, ""); string_set(&Globals.szPidDir, dyn_PIDDIR); - string_set(&Globals.szLockDir, dyn_LOCKDIR); + string_set(&Globals.szCacheDir, dyn_CACHEDIR); + string_set(&Globals.szStateDir, dyn_STATEDIR); string_set(&Globals.szSocketAddress, "0.0.0.0"); pstrcpy(s, "Samba "); pstrcat(s, SAMBA_VERSION_STRING); @@ -1642,7 +1647,7 @@ Globals.bASUSupport = False; /* User defined shares. */ - pstrcpy(s, dyn_LOCKDIR); + pstrcpy(s, dyn_STATEDIR); pstrcat(s, "/usershares"); string_set(&Globals.szUsersharePath, s); string_set(&Globals.szUsershareTemplateShare, ""); @@ -1761,7 +1766,8 @@ FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand) FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand) FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap) -FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir) +FN_GLOBAL_STRING(lp_cachedir, &Globals.szCacheDir) +FN_GLOBAL_STRING(lp_statedir, &Globals.szStateDir) FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir) FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod) FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix) @@ -3333,6 +3339,14 @@ return True; } +/************** handle deprecated lock directory paramter ***************/ + +static BOOL handle_lock_dir(int snum, const char *pszParmValue, char **ptr) +{ + /* set also the state dir */ + string_set(&Globals.szStateDir, pszParmValue); +} + /*************************************************************************** Initialise a copymap. diff -uPr samba-3.0.24.old/source/passdb/login_cache.c samba-3.0.24.new/source/passdb/login_cache.c --- samba-3.0.24.old/source/passdb/login_cache.c 2007-02-04 13:59:21.000000000 -0500 +++ samba-3.0.24.new/source/passdb/login_cache.c 2007-03-06 15:27:15.000000000 -0500 @@ -36,7 +36,7 @@ /* skip file open if it's already opened */ if (cache) return True; - asprintf(&cache_fname, "%s/%s", lp_lockdir(), LOGIN_CACHE_FILE); + asprintf(&cache_fname, "%s/%s", lp_cachedir(), LOGIN_CACHE_FILE); if (cache_fname) DEBUG(5, ("Opening cache file at %s\n", cache_fname)); else { diff -uPr samba-3.0.24.old/source/passdb/pdb_tdb.c samba-3.0.24.new/source/passdb/pdb_tdb.c --- samba-3.0.24.old/source/passdb/pdb_tdb.c 2007-02-04 13:59:21.000000000 -0500 +++ samba-3.0.24.new/source/passdb/pdb_tdb.c 2007-03-06 16:00:05.000000000 -0500 @@ -1548,7 +1548,7 @@ uint32 rid; BOOL ret = False; - tdb = tdb_open_log(lock_path("winbindd_idmap.tdb"), 0, + tdb = tdb_open_log(state_path("winbindd_idmap.tdb"), 0, TDB_DEFAULT, O_RDWR | O_CREAT, 0644); if (tdb == NULL) { diff -uPr samba-3.0.24.old/source/printing/nt_printing.c samba-3.0.24.new/source/printing/nt_printing.c --- samba-3.0.24.old/source/printing/nt_printing.c 2007-02-04 14:09:01.000000000 -0500 +++ samba-3.0.24.new/source/printing/nt_printing.c 2007-03-06 16:01:19.000000000 -0500 @@ -551,28 +551,28 @@ if (tdb_drivers) tdb_close(tdb_drivers); - tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb_drivers) { DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n", - lock_path("ntdrivers.tdb"), strerror(errno) )); + state_path("ntdrivers.tdb"), strerror(errno) )); return False; } if (tdb_printers) tdb_close(tdb_printers); - tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb_printers) { DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n", - lock_path("ntprinters.tdb"), strerror(errno) )); + state_path("ntprinters.tdb"), strerror(errno) )); return False; } if (tdb_forms) tdb_close(tdb_forms); - tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb_forms) { DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n", - lock_path("ntforms.tdb"), strerror(errno) )); + state_path("ntforms.tdb"), strerror(errno) )); return False; } @@ -2348,7 +2348,7 @@ close_all_print_db(); if (geteuid() == 0) { - pstrcpy(printdb_path, lock_path("printing/")); + pstrcpy(printdb_path, state_path("printing/")); pstrcat(printdb_path, sharename); pstrcat(printdb_path, ".tdb"); diff -uPr samba-3.0.24.old/source/printing/printing.c samba-3.0.24.new/source/printing/printing.c --- samba-3.0.24.old/source/printing/printing.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/printing/printing.c 2007-03-06 16:01:54.000000000 -0500 @@ -183,9 +183,9 @@ int services = lp_numservices(); int snum; - unlink(lock_path("printing.tdb")); - pstrcpy(printing_path,lock_path("printing")); - mkdir(printing_path,0755); + unlink(state_path("printing.tdb")); + pstrcpy(printing_path, state_path("printing")); + mkdir(printing_path, 0755); /* handle a Samba upgrade */ diff -uPr samba-3.0.24.old/source/printing/printing_db.c samba-3.0.24.new/source/printing/printing_db.c --- samba-3.0.24.old/source/printing/printing_db.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/printing/printing_db.c 2007-03-06 16:02:04.000000000 -0500 @@ -91,7 +91,7 @@ DLIST_ADD(print_db_head, p); } - pstrcpy(printdb_path, lock_path("printing/")); + pstrcpy(printdb_path, state_path("printing/")); pstrcat(printdb_path, printername); pstrcat(printdb_path, ".tdb"); diff -uPr samba-3.0.24.old/source/registry/reg_db.c samba-3.0.24.new/source/registry/reg_db.c --- samba-3.0.24.old/source/registry/reg_db.c 2006-04-19 22:29:45.000000000 -0400 +++ samba-3.0.24.new/source/registry/reg_db.c 2007-03-06 16:02:35.000000000 -0500 @@ -205,12 +205,12 @@ if ( tdb_reg ) return True; - if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) ) + if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) ) { - tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if ( !tdb_reg ) { DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n", - lock_path("registry.tdb"), strerror(errno) )); + state_path("registry.tdb"), strerror(errno) )); return False; } @@ -252,11 +252,11 @@ become_root(); - tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600); + tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600); if ( !tdb_reg ) { result = ntstatus_to_werror( map_nt_error_from_unix( errno ) ); DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", - lock_path("registry.tdb"), strerror(errno) )); + state_path("registry.tdb"), strerror(errno) )); } unbecome_root(); diff -uPr samba-3.0.24.old/source/registry/reg_perfcount.c samba-3.0.24.new/source/registry/reg_perfcount.c --- samba-3.0.24.old/source/registry/reg_perfcount.c 2007-02-04 13:59:26.000000000 -0500 +++ samba-3.0.24.new/source/registry/reg_perfcount.c 2007-03-06 16:03:22.000000000 -0500 @@ -44,7 +44,7 @@ fstr_sprintf( path, "%s/%s", PERFCOUNTDIR, dbname ); - pstrcpy( fname, lock_path( path ) ); + pstrcpy( fname, state_path( path ) ); return fname; } @@ -54,7 +54,7 @@ void perfcount_init_keys( void ) { - char *p = lock_path(PERFCOUNTDIR); + char *p = state_path(PERFCOUNTDIR); /* no registry keys; just create the perfmon directory */ diff -uPr samba-3.0.24.old/source/rpc_server/srv_eventlog_lib.c samba-3.0.24.new/source/rpc_server/srv_eventlog_lib.c --- samba-3.0.24.old/source/rpc_server/srv_eventlog_lib.c 2007-02-04 13:59:21.000000000 -0500 +++ samba-3.0.24.new/source/rpc_server/srv_eventlog_lib.c 2007-03-06 16:03:50.000000000 -0500 @@ -67,7 +67,7 @@ { fstring path; char *tdb_fullpath; - char *eventlogdir = lock_path( "eventlog" ); + char *eventlogdir = state_path( "eventlog" ); pstr_sprintf( path, "%s/%s.tdb", eventlogdir, name ); strlower_m( path ); @@ -349,7 +349,7 @@ /* make sure that the eventlog dir exists */ - eventlogdir = lock_path( "eventlog" ); + eventlogdir = state_path( "eventlog" ); if ( !directory_exist( eventlogdir, NULL ) ) mkdir( eventlogdir, 0755 ); diff -uPr samba-3.0.24.old/source/rpc_server/srv_netlog_nt.c samba-3.0.24.new/source/rpc_server/srv_netlog_nt.c --- samba-3.0.24.old/source/rpc_server/srv_netlog_nt.c 2007-02-04 13:59:21.000000000 -0500 +++ samba-3.0.24.new/source/rpc_server/srv_netlog_nt.c 2007-03-06 16:07:25.000000000 -0500 @@ -77,7 +77,7 @@ { TDB_CONTEXT *tdb; - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (!tdb) { diff -uPr samba-3.0.24.old/source/sam/idmap_tdb.c samba-3.0.24.new/source/sam/idmap_tdb.c --- samba-3.0.24.old/source/sam/idmap_tdb.c 2006-04-19 22:29:35.000000000 -0400 +++ samba-3.0.24.new/source/sam/idmap_tdb.c 2007-03-06 16:04:00.000000000 -0500 @@ -449,7 +449,7 @@ BOOL tdb_is_new = False; /* use the old database if present */ - tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb")); + tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb")); if (!tdbfile) { DEBUG(0, ("idmap_init: out of memory!\n")); return NT_STATUS_NO_MEMORY; diff -uPr samba-3.0.24.old/source/script/mkbuildoptions.awk samba-3.0.24.new/source/script/mkbuildoptions.awk --- samba-3.0.24.old/source/script/mkbuildoptions.awk 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/script/mkbuildoptions.awk 2007-03-06 15:40:45.000000000 -0500 @@ -86,7 +86,8 @@ print " output(screen,\" LIBDIR: %s\\n\",dyn_LIBDIR);"; print " output(screen,\" SHLIBEXT: %s\\n\",dyn_SHLIBEXT);"; - print " output(screen,\" LOCKDIR: %s\\n\",dyn_LOCKDIR);"; + print " output(screen,\" STATEDIR: %s\\n\",dyn_STATEDIR);"; + print " output(screen,\" CACHEDIR: %s\\n\",dyn_CACHEDIR);"; print " output(screen,\" PIDDIR: %s\\n\", dyn_PIDDIR);"; print " output(screen,\" SMB_PASSWD_FILE: %s\\n\",dyn_SMB_PASSWD_FILE);"; diff -uPr samba-3.0.24.old/source/script/tests/selftest.sh samba-3.0.24.new/source/script/tests/selftest.sh --- samba-3.0.24.old/source/script/tests/selftest.sh 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/script/tests/selftest.sh 2007-03-06 15:42:00.000000000 -0500 @@ -41,13 +41,14 @@ SERVERCONFFILE=$LIBDIR/server.conf COMMONCONFFILE=$LIBDIR/common.conf PRIVATEDIR=$PREFIX_ABS/private -LOCKDIR=$PREFIX_ABS/lockdir +STATEDIR=$PREFIX_ABS/lockdir +CACHEDIR=$PREFIX_ABS/lockdir LOGDIR=$PREFIX_ABS/logs SOCKET_WRAPPER_DIR=$PREFIX/sw CONFIGURATION="-s $CONFFILE" export PREFIX PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN -export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE +export PRIVATEDIR LIBDIR PIDDIR STATEDIR CACHEDIR LOGDIR SERVERCONFFILE export SRCDIR SCRIPTDIR export USERNAME PASSWORD export SMBTORTURE4 @@ -73,7 +74,7 @@ ## echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"... /bin/rm -rf $PREFIX/* -mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR +mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $STATEDIR $CACHEDIR $LOGDIR $SOCKET_WRAPPER_DIR mkdir -p $PREFIX_ABS/tmp chmod 777 $PREFIX_ABS/tmp @@ -86,7 +87,8 @@ private dir = $PRIVATEDIR pid directory = $PIDDIR - lock directory = $LOCKDIR + state directory = $STATEDIR + cache directory = $CACHEDIR log file = $LOGDIR/log.%m log level = 0 diff -uPr samba-3.0.24.old/source/smbd/connection.c samba-3.0.24.new/source/smbd/connection.c --- samba-3.0.24.old/source/smbd/connection.c 2005-10-17 22:44:57.000000000 -0400 +++ samba-3.0.24.new/source/smbd/connection.c 2007-03-06 16:04:14.000000000 -0500 @@ -29,7 +29,7 @@ TDB_CONTEXT *conn_tdb_ctx(void) { if (!tdb) - tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); return tdb; @@ -131,7 +131,7 @@ TDB_DATA kbuf, dbuf; if (!tdb) - tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); if (!tdb) diff -uPr samba-3.0.24.old/source/smbd/lanman.c samba-3.0.24.new/source/smbd/lanman.c --- samba-3.0.24.old/source/smbd/lanman.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/smbd/lanman.c 2007-03-06 16:04:30.000000000 -0500 @@ -1052,9 +1052,9 @@ BOOL local_list_only; int i; - lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0); + lines = file_lines_load(state_path(SERVER_LIST), NULL, 0); if (!lines) { - DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno))); + DEBUG(4,("Can't open %s - %s\n",state_path(SERVER_LIST),strerror(errno))); return 0; } diff -uPr samba-3.0.24.old/source/smbd/oplock_irix.c samba-3.0.24.new/source/smbd/oplock_irix.c --- samba-3.0.24.old/source/smbd/oplock_irix.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/smbd/oplock_irix.c 2007-03-06 15:27:35.000000000 -0500 @@ -38,7 +38,7 @@ set_effective_capability(KERNEL_OPLOCK_CAPABILITY); - slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), (int)sys_getpid()); + slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_cachedir(), (int)sys_getpid()); if(pipe(pfd) != 0) { DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error was %s\n", diff -uPr samba-3.0.24.old/source/smbd/server.c samba-3.0.24.new/source/smbd/server.c --- samba-3.0.24.old/source/smbd/server.c 2007-02-04 13:59:13.000000000 -0500 +++ samba-3.0.24.new/source/smbd/server.c 2007-03-06 15:28:08.000000000 -0500 @@ -902,8 +902,11 @@ setpgid( (pid_t)0, (pid_t)0); #endif - if (!directory_exist(lp_lockdir(), NULL)) - mkdir(lp_lockdir(), 0755); + if (!directory_exist(lp_cachedir(), NULL)) + mkdir(lp_cachedir(), 0755); + + if (!directory_exist(lp_statedir(), NULL)) + mkdir(lp_statedir(), 0755); if (is_daemon) pidfile_create("smbd"); diff -uPr samba-3.0.24.old/source/smbd/session.c samba-3.0.24.new/source/smbd/session.c --- samba-3.0.24.old/source/smbd/session.c 2006-04-19 22:29:19.000000000 -0400 +++ samba-3.0.24.new/source/smbd/session.c 2007-03-06 16:04:55.000000000 -0500 @@ -34,7 +34,7 @@ if (tdb) return True; - tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + tdb = tdb_open_log(cache_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); if (!tdb) { DEBUG(1,("session_init: failed to open sessionid tdb\n")); diff -uPr samba-3.0.24.old/source/utils/net_idmap.c samba-3.0.24.new/source/utils/net_idmap.c --- samba-3.0.24.old/source/utils/net_idmap.c 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/utils/net_idmap.c 2007-03-06 16:05:03.000000000 -0500 @@ -136,7 +136,7 @@ return NT_STATUS_UNSUCCESSFUL; } - tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb")); + tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb")); if (!tdbfile) { DEBUG(0, ("idmap_init: out of memory!\n")); return NT_STATUS_NO_MEMORY; diff -uPr samba-3.0.24.old/source/utils/net_status.c samba-3.0.24.new/source/utils/net_status.c --- samba-3.0.24.old/source/utils/net_status.c 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/utils/net_status.c 2007-03-06 16:05:45.000000000 -0500 @@ -70,11 +70,11 @@ "------------------------\n"); } - tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, + tdb = tdb_open_log(cache_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (tdb == NULL) { - d_fprintf(stderr, "%s not initialised\n", lock_path("sessionid.tdb")); + d_fprintf(stderr, "%s not initialised\n", cache_path("sessionid.tdb")); return -1; } @@ -186,22 +186,22 @@ ids.num_entries = 0; ids.entries = NULL; - tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, + tdb = tdb_open_log(cache_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (tdb == NULL) { - d_fprintf(stderr, "%s not initialised\n", lock_path("sessionid.tdb")); + d_fprintf(stderr, "%s not initialised\n", cache_path("sessionid.tdb")); return -1; } tdb_traverse(tdb, collect_pid, &ids); tdb_close(tdb); - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (tdb == NULL) { - d_fprintf(stderr, "%s not initialised\n", lock_path("connections.tdb")); + d_fprintf(stderr, "%s not initialised\n", cache_path("connections.tdb")); d_fprintf(stderr, "This is normal if no SMB client has ever " "connected to your server.\n"); return -1; @@ -226,12 +226,12 @@ d_printf("-------------------------------------" "------------------\n"); - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (tdb == NULL) { d_fprintf(stderr, "%s not initialised\n", - lock_path("connections.tdb")); + cache_path("connections.tdb")); d_fprintf(stderr, "This is normal if no SMB client has " "ever connected to your server.\n"); return -1; diff -uPr samba-3.0.24.old/source/utils/smbcontrol.c samba-3.0.24.new/source/utils/smbcontrol.c --- samba-3.0.24.old/source/utils/smbcontrol.c 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/utils/smbcontrol.c 2007-03-06 16:06:33.000000000 -0500 @@ -61,7 +61,7 @@ if (procid_to_pid(&pid) != 0) return message_send_pid(pid, msg_type, buf, len, duplicates); - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDWR, 0); if (!tdb) { fprintf(stderr,"Failed to open connections database" @@ -286,7 +286,7 @@ } else { TDB_CONTEXT * tdb; - tdb = tdb_open_log(lock_path("connections.tdb"), 0, + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (!tdb) { fprintf(stderr, @@ -828,10 +828,10 @@ /* Remove the entry in the winbindd_cache tdb to tell a later starting winbindd that we're online. */ - tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600); + tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600); if (!tdb) { fprintf(stderr, "Cannot open the tdb %s for writing.\n", - lock_path("winbindd_cache.tdb")); + cache_path("winbindd_cache.tdb")); return False; } @@ -864,13 +864,13 @@ starting winbindd that we're offline. We may actually create it here... */ - tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), + tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE, TDB_DEFAULT /* TDB_CLEAR_IF_FIRST */, O_RDWR|O_CREAT, 0600); if (!tdb) { fprintf(stderr, "Cannot open the tdb %s for writing.\n", - lock_path("winbindd_cache.tdb")); + cache_path("winbindd_cache.tdb")); return False; } diff -uPr samba-3.0.24.old/source/utils/status.c samba-3.0.24.new/source/utils/status.c --- samba-3.0.24.old/source/utils/status.c 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/utils/status.c 2007-03-06 16:07:00.000000000 -0500 @@ -669,7 +669,7 @@ } if ( show_processes ) { - tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); + tdb = tdb_open_log(cache_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (!tdb) { d_printf("sessionid.tdb not initialised\n"); } else { @@ -686,13 +686,13 @@ } if ( show_shares ) { - tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (!tdb) { - d_printf("%s not initialised\n", lock_path("connections.tdb")); + d_printf("%s not initialised\n", cache_path("connections.tdb")); d_printf("This is normal if an SMB client has never connected to your server.\n"); } else { if (verbose) { - d_printf("Opened %s\n", lock_path("connections.tdb")); + d_printf("Opened %s\n", cache_path("connections.tdb")); } if (brief) diff -uPr samba-3.0.24.old/source/utils/testparm.c samba-3.0.24.new/source/utils/testparm.c --- samba-3.0.24.old/source/utils/testparm.c 2007-02-04 13:59:25.000000000 -0500 +++ samba-3.0.24.new/source/utils/testparm.c 2007-03-06 15:29:34.000000000 -0500 @@ -57,13 +57,23 @@ ret = 1; } - if (!directory_exist(lp_lockdir(), &st)) { - fprintf(stderr, "ERROR: lock directory %s does not exist\n", - lp_lockdir()); + if (!directory_exist(lp_cachedir(), &st)) { + fprintf(stderr, "ERROR: cache directory %s does not exist\n", + lp_cachedir()); ret = 1; } else if ((st.st_mode & 0777) != 0755) { - fprintf(stderr, "WARNING: lock directory %s should have permissions 0755 for browsing to work\n", - lp_lockdir()); + fprintf(stderr, "WARNING: cache directory %s should have permissions 0755 for browsing to work\n", + lp_cachedir()); + ret = 1; + } + + if (!directory_exist(lp_statedir(), &st)) { + fprintf(stderr, "ERROR: state directory %s does not exist\n", + lp_statedir()); + ret = 1; + } else if ((st.st_mode & 0777) != 0755) { + fprintf(stderr, "WARNING: state directory %s should have permissions 0755 for browsing to work\n", + lp_statedir()); ret = 1; } diff -uPr samba-3.0.24.old/source/web/statuspage.c samba-3.0.24.new/source/web/statuspage.c --- samba-3.0.24.old/source/web/statuspage.c 2007-02-04 13:59:21.000000000 -0500 +++ samba-3.0.24.new/source/web/statuspage.c 2007-03-06 16:07:08.000000000 -0500 @@ -319,7 +319,7 @@ PID_or_Machine = 0; } - tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); + tdb = tdb_open_log(cache_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); if (tdb) tdb_traverse(tdb, traverse_fn1, NULL); initPid2Machine ();