rpms/samba/FC-6 samba-3.0.24-arch_macro.patch, NONE, 1.1 samba-3.0.24-enable_pam_nss_tests.patch, NONE, 1.1 samba-3.0.24-fhs-compliance.patch, NONE, 1.1 samba-3.0.24-msdfs-root-no.patch, NONE, 1.1 samba-3.0.24-nss_wins.patch, NONE, 1.1 samba-3.0.24-pam_winbind-fixes.patch, NONE, 1.1 samba-3.0.24-vista-patchset.patch, NONE, 1.1 samba-3.0.24-vista_msdfs_errcodes.patch, NONE, 1.1 samba.spec, 1.75, 1.76

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Apr 5 20:29:52 UTC 2007


Author: ssorce

Update of /cvs/dist/rpms/samba/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv7015

Modified Files:
	samba.spec 
Added Files:
	samba-3.0.24-arch_macro.patch 
	samba-3.0.24-enable_pam_nss_tests.patch 
	samba-3.0.24-fhs-compliance.patch 
	samba-3.0.24-msdfs-root-no.patch samba-3.0.24-nss_wins.patch 
	samba-3.0.24-pam_winbind-fixes.patch 
	samba-3.0.24-vista-patchset.patch 
	samba-3.0.24-vista_msdfs_errcodes.patch 
Log Message:

various bug fixes from rawhide



samba-3.0.24-arch_macro.patch:
 negprot.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

--- NEW FILE samba-3.0.24-arch_macro.patch ---
------------------------------------------------------------------------
r21857 | gd | 2007-03-16 17:20:47 +0100 (Fri, 16 Mar 2007) | 4 lines

Stop pretending to be Vista in the %a macro towards Samba clients.

Guenther

------------------------------------------------------------------------
Index: source/smbd/negprot.c
===================================================================
--- source/smbd/negprot.c	(revision 21856)
+++ source/smbd/negprot.c	(revision 21857)
@@ -259,7 +259,9 @@ static int reply_nt1(char *inbuf, char *
 	if ( (SVAL(inbuf, smb_flg2) & FLAGS2_EXTENDED_SECURITY) &&
 		((SVAL(inbuf, smb_flg2) & FLAGS2_UNKNOWN_BIT4) == 0) ) 
 	{
-		set_remote_arch( RA_VISTA );		
+		if (get_remote_arch() != RA_SAMBA) {
+			set_remote_arch( RA_VISTA );
+		}
 	}
 
 	/* do spnego in user level security if the client

samba-3.0.24-enable_pam_nss_tests.patch:
 Makefile.in |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)

--- NEW FILE samba-3.0.24-enable_pam_nss_tests.patch ---
--- source/Makefile.in
+++ source/Makefile.in
@@ -160,6 +160,8 @@
 
 PAM_MODULES = @PAM_MODULES@
 
+NSS_MODULES = @WINBIND_WINS_NSS@ @WINBIND_NSS@
+
 SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb
 
 VFS_MODULES = @VFS_MODULES@
@@ -769,6 +771,12 @@
 all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(ROOT_SBIN_PROGS) \
 	$(SHLIBS) $(MODULES) $(PAM_MODULES) @EXTRA_ALL_TARGETS@
 
+nss_modules : $(NSS_MODULES)
+
+libnss_winbind : SHOWFLAGS proto_exists nsswitch/libnss_winbind. at SHLIBEXT@
+
+libnss_wins : SHOWFLAGS proto_exists nsswitch/libnss_wins. at SHLIBEXT@
+
 pam_modules : $(PAM_MODULES)
 
 pam_smbpass : SHOWFLAGS proto_exists bin/pam_smbpass. at SHLIBEXT@
@@ -1736,6 +1744,14 @@
 ######################################################################
 # Samba Testing Framework
 
+# Check for NSS module problems. 
+test_nss_modules: nss_modules
+	@echo "Testing $(NSS_MODULES) "
+	@for module in $(NSS_MODULES); do \
+		./script/tests/dlopen.sh $${module} \
+			|| exit 1; \
+	done
+
 # Check for PAM module problems.  Specifically, check that every module we
 # built can actually be loaded by a minimal PAM-aware application.
 test_pam_modules: pam_modules

samba-3.0.24-fhs-compliance.patch:
 Makefile.in                   |   10 ++++++----
 configure.in                  |   35 +++++++++++++++++++++++++++--------
 dynconfig.c                   |    3 ++-
 groupdb/mapping.c             |    2 +-
 include/dynconfig.h           |    3 ++-
 intl/lang_tdb.c               |    2 +-
 lib/account_pol.c             |    2 +-
 lib/gencache.c                |    2 +-
 lib/messages.c                |    2 +-
 lib/popt_common.c             |   25 +++++++++++++++++++++++--
 lib/sharesec.c                |    4 ++--
 lib/util.c                    |   26 +++++++++++++++++++++++---
 libsmb/gpo.c                  |    2 +-
 libsmb/samlogon_cache.c       |    4 ++--
 libsmb/unexpected.c           |    4 ++--
 locking/brlock.c              |    4 ++--
 locking/locking.c             |    2 +-
 nmbd/nmbd.c                   |    4 ++--
 nmbd/nmbd_namelistdb.c        |    2 +-
 nmbd/nmbd_processlogon.c      |    2 +-
 nmbd/nmbd_serverlistdb.c      |    2 +-
 nmbd/nmbd_synclists.c         |    2 +-
 nmbd/nmbd_winsserver.c        |    6 +++---
 nsswitch/winbindd_cache.c     |    4 ++--
 nsswitch/winbindd_util.c      |    4 ++--
 param/loadparm.c              |   26 ++++++++++++++++++++------
 passdb/login_cache.c          |    2 +-
 passdb/pdb_tdb.c              |    2 +-
 printing/nt_printing.c        |   14 +++++++-------
 printing/printing.c           |    6 +++---
 printing/printing_db.c        |    2 +-
 registry/reg_db.c             |   10 +++++-----
 registry/reg_perfcount.c      |    4 ++--
 rpc_server/srv_eventlog_lib.c |    4 ++--
 rpc_server/srv_netlog_nt.c    |    2 +-
 sam/idmap_tdb.c               |    2 +-
 script/mkbuildoptions.awk     |    3 ++-
 script/tests/selftest.sh      |   10 ++++++----
 smbd/connection.c             |    4 ++--
 smbd/lanman.c                 |    4 ++--
 smbd/oplock_irix.c            |    2 +-
 smbd/server.c                 |    7 +++++--
 smbd/session.c                |    2 +-
 utils/net_idmap.c             |    2 +-
 utils/net_status.c            |   16 ++++++++--------
 utils/smbcontrol.c            |   12 ++++++------
 utils/status.c                |    8 ++++----
 utils/testparm.c              |   20 +++++++++++++++-----
 web/statuspage.c              |    2 +-
 49 files changed, 209 insertions(+), 115 deletions(-)

--- NEW FILE samba-3.0.24-fhs-compliance.patch ---
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 ();

samba-3.0.24-msdfs-root-no.patch:
 loadparm.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE samba-3.0.24-msdfs-root-no.patch ---
--- samba-3.0.24.orig/source/param/loadparm.c	2007-02-04 13:59:13.000000000 -0500
+++ samba-3.0.24/source/param/loadparm.c	2007-02-20 14:03:49.000000000 -0500
@@ -570,7 +570,7 @@
 	False,			/* bInheritPerms */
 	False,			/* bInheritACLS */
 	False,			/* bInheritOwner */
-	True,			/* bMSDfsRoot */
+	False,			/* bMSDfsRoot */
 	False,			/* bUseClientDriver */
 	True,			/* bDefaultDevmode */
 	False,			/* bForcePrintername */

samba-3.0.24-nss_wins.patch:
 Makefile.in |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE samba-3.0.24-nss_wins.patch ---
Index: source/Makefile.in
===================================================================
--- source/Makefile.in.orig
+++ source/Makefile.in
@@ -687,7 +687,8 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) \
             $(RPC_NTSVCS_OBJ) utils/passwd_util.o
 
 WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) \
-	$(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ)
+	$(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ) \
+	$(SECRETS_OBJ)
 
 WINBIND_WINS_NSS_PICOBJS = $(WINBIND_WINS_NSS_OBJ:.o=. at PICSUFFIX@)
 
@@ -1231,7 +1232,7 @@ bin/winbindd at EXEEXT@: $(WINBINDD_OBJ) @B
 @WINBIND_WINS_NSS@: $(WINBIND_WINS_NSS_PICOBJS)
 	@echo "Linking $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_WINS_NSS_PICOBJS) \
-		$(LDAP_LIBS) $(KRB5LIBS) \
+		$(LDAP_LIBS) $(KRB5LIBS) $(LIBS) \
 		@SONAMEFLAG@`basename $@`@NSSSONAMEVERSIONSUFFIX@
 
 bin/pam_winbind. at SHLIBEXT@: $(PAM_WINBIND_OBJ:.o=. at PICSUFFIX@) bin/.dummy

samba-3.0.24-pam_winbind-fixes.patch:
 pam_winbind.c |   67 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 44 insertions(+), 23 deletions(-)

--- NEW FILE samba-3.0.24-pam_winbind-fixes.patch ---
------------------------------------------------------------------------
r21143 | gd | 2007-02-05 15:34:12 +0100 (Mon, 05 Feb 2007) | 7 lines

Fix wrong check for pam error codes for getpwnam and lookup winbind
requests in pam_winbind (Bug #4094).

Inspired by fix from Lars Heete.

Guenther

------------------------------------------------------------------------
Index: source/nsswitch/pam_winbind.c
===================================================================
--- source/nsswitch/pam_winbind.c	(revision 21142)
+++ source/nsswitch/pam_winbind.c	(revision 21143)
@@ -444,21 +444,34 @@ static int pam_winbind_request(pam_handl
 	close_sock();
 
 	/* Copy reply data from socket */
-	if (response->result != WINBINDD_OK) {
-		if (response->data.auth.pam_error != PAM_SUCCESS) {
-			_pam_log(LOG_ERR, "request failed: %s, PAM error was %s (%d), NT error was %s", 
-				 response->data.auth.error_string,
-				 pam_strerror(pamh, response->data.auth.pam_error),
-				 response->data.auth.pam_error,
-				 response->data.auth.nt_status_string);
-			return response->data.auth.pam_error;
-		} else {
-			_pam_log(LOG_ERR, "request failed, but PAM error 0!");
-			return PAM_SERVICE_ERR;
-		}
+	if (response->result == WINBINDD_OK) {
+		return PAM_SUCCESS;
 	}
 
-	return PAM_SUCCESS;
+	/* no need to check for pam_error codes for getpwnam() */
+	switch (req_type) {
+
+		case WINBINDD_GETPWNAM:
+		case WINBINDD_LOOKUPNAME:
+			_pam_log(LOG_ERR, "request failed: %s, NT error was %s", 
+				response->data.auth.nt_status_string);
+			return PAM_USER_UNKNOWN;
+		default:
+			break;
+	}
+
+	if (response->data.auth.pam_error != PAM_SUCCESS) {
+		_pam_log(LOG_ERR, "request failed: %s, PAM error was %s (%d), NT error was %s", 
+			 response->data.auth.error_string,
+			 pam_strerror(pamh, response->data.auth.pam_error),
+			 response->data.auth.pam_error,
+			 response->data.auth.nt_status_string);
+		return response->data.auth.pam_error;
+	} 
+	
+	_pam_log(LOG_ERR, "request failed, but PAM error 0!");
+
+	return PAM_SERVICE_ERR;
 }
 
 static int pam_winbind_request_log(pam_handle_t * pamh,
------------------------------------------------------------------------
r21310 | gd | 2007-02-13 12:04:10 +0100 (Tue, 13 Feb 2007) | 4 lines

Fix invalid printfs in pam_winbind.

Guenther

------------------------------------------------------------------------
Index: source/nsswitch/pam_winbind.c
===================================================================
--- source/nsswitch/pam_winbind.c	(revision 21309)
+++ source/nsswitch/pam_winbind.c	(revision 21310)
@@ -461,8 +461,12 @@ static int pam_winbind_request(pam_handl
 
 		case WINBINDD_GETPWNAM:
 		case WINBINDD_LOOKUPNAME:
-			_pam_log(LOG_ERR, "request failed: %s, NT error was %s", 
+			if (strlen(response->data.auth.nt_status_string) > 0) {
+				_pam_log(LOG_ERR, "request failed, NT error was %s", 
 				response->data.auth.nt_status_string);
+			} else {
+				_pam_log(LOG_ERR, "request failed");
+			}
 			return PAM_USER_UNKNOWN;
 		default:
 			break;
@@ -518,15 +522,19 @@ static int pam_winbind_request_log(pam_h
 		}	 
 		return retval;
 	case PAM_SUCCESS:
-		if (req_type == WINBINDD_PAM_AUTH) {
-			/* Otherwise, the authentication looked good */
-			_pam_log(LOG_NOTICE, "user '%s' granted access", user);
-		} else if (req_type == WINBINDD_PAM_CHAUTHTOK) {
-			/* Otherwise, the authentication looked good */
-			_pam_log(LOG_NOTICE, "user '%s' password changed", user);
-		} else { 
-			/* Otherwise, the authentication looked good */
-			_pam_log(LOG_NOTICE, "user '%s' OK", user);
+		/* Otherwise, the authentication looked good */
+		switch (req_type) {
+			case WINBINDD_INFO:
+				break;
+			case WINBINDD_PAM_AUTH:
+				_pam_log(LOG_NOTICE, "user '%s' granted access", user);
+				break;
+			case WINBINDD_PAM_CHAUTHTOK:
+				_pam_log(LOG_NOTICE, "user '%s' password changed", user);
+				break;
+			default:
+				_pam_log(LOG_NOTICE, "user '%s' OK", user);
+				break;
 		}
 	
 		return retval;

samba-3.0.24-vista-patchset.patch:
 auth/auth_compat.c          |   13 ++++--
 include/smb.h               |    4 +-
 lib/dummysmbd.c             |    6 +++
 lib/util.c                  |    3 +
 locking/locking.c           |    5 ++
 printing/nt_printing.c      |   87 +++++++++++++++++++++++++++++++++++++++-----
 rpc_parse/parse_spoolss.c   |   11 +++++
 rpc_server/srv_spoolss.c    |    9 ++++
 rpc_server/srv_spoolss_nt.c |   15 +++++++
 smbd/dir.c                  |   39 +++++++++++++++++++
 smbd/msdfs.c                |    6 ++-
 smbd/negprot.c              |   45 ++++++++++++++++++----
 smbd/password.c             |   25 ++++++++++++
 smbd/posix_acls.c           |   26 ++++++++++++-
 smbd/sesssetup.c            |    1 
 15 files changed, 269 insertions(+), 26 deletions(-)

--- NEW FILE samba-3.0.24-vista-patchset.patch ---
Index: samba-3.0.24/source/auth/auth_compat.c
===================================================================
--- samba-3.0.24.orig/source/auth/auth_compat.c	2007-02-08 08:01:57.000000000 -0600
+++ samba-3.0.24/source/auth/auth_compat.c	2007-02-08 08:02:08.000000000 -0600
@@ -92,18 +92,25 @@
 check if a username/password pair is ok via the auth subsystem.
 return True if the password is correct, False otherwise
 ****************************************************************************/
+
 BOOL password_ok(char *smb_name, DATA_BLOB password_blob)
 {
 
 	DATA_BLOB null_password = data_blob(NULL, 0);
-	BOOL encrypted = (global_encrypted_passwords_negotiated && password_blob.length == 24);
+	BOOL encrypted = (global_encrypted_passwords_negotiated && (password_blob.length == 24 || password_blob.length > 46));
 	
 	if (encrypted) {
 		/* 
 		 * The password could be either NTLM or plain LM.  Try NTLM first, 
 		 * but fall-through as required.
-		 * NTLMv2 makes no sense here.
+		 * Vista sends NTLMv2 here - we need to try the client given workgroup.
 		 */
+		if (get_session_workgroup()) {
+			if (NT_STATUS_IS_OK(pass_check_smb(smb_name, get_session_workgroup(), null_password, password_blob, null_password, encrypted))) {
+				return True;
+			}
+		}
+
 		if (NT_STATUS_IS_OK(pass_check_smb(smb_name, lp_workgroup(), null_password, password_blob, null_password, encrypted))) {
 			return True;
 		}
@@ -119,5 +126,3 @@
 
 	return False;
 }
-
-
Index: samba-3.0.24/source/smbd/password.c
===================================================================
--- samba-3.0.24.orig/source/smbd/password.c	2007-02-08 08:01:42.000000000 -0600
+++ samba-3.0.24/source/smbd/password.c	2007-02-08 08:02:08.000000000 -0600
@@ -23,6 +23,8 @@
 /* users from session setup */
 static char *session_userlist = NULL;
 static int len_session_userlist = 0;
+/* workgroup from session setup. */
+static char *session_workgroup = NULL;
 
 /* this holds info on user ids that are already validated for this VC */
 static user_struct *validated_users;
@@ -406,6 +408,29 @@
 }
 
 /****************************************************************************
+ In security=share mode we need to store the client workgroup, as that's
+  what Vista uses for the NTLMv2 calculation.
+****************************************************************************/
+
+void add_session_workgroup(const char *workgroup)
+{
+	if (session_workgroup) {
+		SAFE_FREE(session_workgroup);
+	}
+	session_workgroup = smb_xstrdup(workgroup);
+}
+
+/****************************************************************************
+ In security=share mode we need to return the client workgroup, as that's
+  what Vista uses for the NTLMv2 calculation.
+****************************************************************************/
+
+const char *get_session_workgroup(void)
+{
+	return session_workgroup;
+}
+
+/****************************************************************************
  Check if a user is in a netgroup user list. If at first we don't succeed,
  try lower case.
 ****************************************************************************/
Index: samba-3.0.24/source/smbd/sesssetup.c
===================================================================
--- samba-3.0.24.orig/source/smbd/sesssetup.c	2007-02-08 08:01:38.000000000 -0600
+++ samba-3.0.24/source/smbd/sesssetup.c	2007-02-08 08:02:08.000000000 -0600
@@ -1035,6 +1035,7 @@
 
 		map_username(sub_user);
 		add_session_user(sub_user);
+		add_session_workgroup(domain);
 		/* Then force it to null for the benfit of the code below */
 		*user = 0;
 	}
Index: samba-3.0.24/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- samba-3.0.24.orig/source/rpc_server/srv_spoolss_nt.c	2007-02-04 12:59:21.000000000 -0600
+++ samba-3.0.24/source/rpc_server/srv_spoolss_nt.c	2007-02-15 11:02:09.000000000 -0600
@@ -5848,6 +5848,12 @@
 		goto done;
 	}
 	
+	if (!secdesc_ctr) {
+		DEBUG(10,("update_printer_sec: secdesc_ctr is NULL !\n"));
+		result = WERR_INVALID_PARAM;
+		goto done;
+	}
+
 	/* Check the user has permissions to change the security
 	   descriptor.  By experimentation with two NT machines, the user
 	   requires Full Access to the printer to change security
@@ -9378,6 +9384,15 @@
 	
 	/* housekeeping information in the reply */
 	
+	/* Fix from Martin Zielinski <mz at seh.de> - ensure
+	 * the hand marshalled container size is a multiple
+	 * of 4 bytes for RPC alignment.
+	 */
+
+	if (needed % 4) {
+		needed += 4-(needed % 4);
+	}
+
 	r_u->needed 	= needed;
 	r_u->returned 	= num_entries;
 
Index: samba-3.0.24/source/printing/nt_printing.c
===================================================================
--- samba-3.0.24.orig/source/printing/nt_printing.c	2007-02-04 13:09:01.000000000 -0600
+++ samba-3.0.24/source/printing/nt_printing.c	2007-02-15 11:02:09.000000000 -0600
@@ -2984,11 +2984,15 @@
 	return True;
 }
 
+/*****************************************************************
+ ****************************************************************/
+
 static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2, 
 			       struct uuid guid)
 {
 	int i;
 	REGVAL_CTR *ctr=NULL;
+	UNISTR2 unistr_guid;
 
 	/* find the DsSpooler key */
 	if ((i = lookup_printerkey(info2->data, SPOOL_DSSPOOLER_KEY)) < 0)
@@ -2996,8 +3000,18 @@
 	ctr = info2->data->keys[i].values;
 
 	regval_ctr_delvalue(ctr, "objectGUID");
-	regval_ctr_addvalue(ctr, "objectGUID", REG_BINARY, 
-			    (char *) &guid, sizeof(struct uuid));	
+
+	/* We used to store this as a REG_BINARY but that causes
+	   Vista to whine */
+
+	ZERO_STRUCT( unistr_guid );	
+	init_unistr2( &unistr_guid, smb_uuid_string_static(guid),
+		      UNI_STR_TERMINATE );
+
+	regval_ctr_addvalue(ctr, "objectGUID", REG_SZ, 
+			    (char *)unistr_guid.buffer, 
+			    unistr_guid.uni_max_len*2);
+	
 }
 
 static WERROR nt_printer_publish_ads(ADS_STRUCT *ads,
@@ -3254,6 +3268,7 @@
 	REGISTRY_VALUE *guid_val;
 	WERROR win_rc;
 	int i;
+	BOOL ret = False;
 
 	win_rc = get_a_printer(print_hnd, &printer, 2, lp_servicename(snum));
 
@@ -3267,12 +3282,36 @@
 		return False;
 	}
 
-	/* fetching printer guids really ought to be a separate function.. */
-	if (guid && regval_size(guid_val) == sizeof(struct uuid))
-		memcpy(guid, regval_data_p(guid_val), sizeof(struct uuid));
+	/* fetching printer guids really ought to be a separate function. */
+
+	if ( guid ) {	
+		fstring guid_str;
+		
+		/* We used to store the guid as REG_BINARY, then swapped 
+		   to REG_SZ for Vista compatibility so check for both */
+
+		switch ( regval_type(guid_val) ){
+		case REG_SZ:		
+			rpcstr_pull( guid_str, regval_data_p(guid_val), 
+				     sizeof(guid_str)-1, -1, STR_TERMINATE );
+			ret = smb_string_to_uuid( guid_str, guid );
+			break;			
+		case REG_BINARY:
+			if ( regval_size(guid_val) != sizeof(struct uuid) ) {
+				ret = False;
+				break;
+			}
+			memcpy(guid, regval_data_p(guid_val), sizeof(struct uuid));
+			break;
+		default:
+			DEBUG(0,("is_printer_published: GUID value stored as "
+				 "invaluid type (%d)\n", regval_type(guid_val) ));			
+			break;
+		}
+	}
 
 	free_a_printer(&printer, 2);
-	return True;
+	return ret;
 }
 #else
 WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action)
@@ -3539,13 +3578,43 @@
 			break;
 		}
 		
-		/* add the new value */
+		DEBUG(8,("specific: [%s:%s], len: %d\n", keyname, valuename, size));
+
+		/* Vista doesn't like unknown REG_BINARY values in DsSpooler.  
+		   Thanks to Martin Zielinski for the hint. */
+
+		if ( type == REG_BINARY && 
+		     strequal( keyname, SPOOL_DSSPOOLER_KEY ) && 
+		     strequal( valuename, "objectGUID" ) ) 
+		{
+			struct uuid guid;
+			UNISTR2 unistr_guid;
+
+			ZERO_STRUCT( unistr_guid );
+			
+			/* convert the GUID to a UNICODE string */
+			
+			memcpy( &guid, data_p, sizeof(struct uuid) );
+			
+			init_unistr2( &unistr_guid, smb_uuid_string_static(guid), 
+				      UNI_STR_TERMINATE );
+			
+			regval_ctr_addvalue( printer_data->keys[key_index].values, 
+					     valuename, REG_SZ, 
+					     (const char *)unistr_guid.buffer, 
+					     unistr_guid.uni_str_len*2 );
+
+		} else {
+			/* add the value */
+
+			regval_ctr_addvalue( printer_data->keys[key_index].values, 
+					     valuename, type, (const char *)data_p, 
+					     size );
+		}
 		
-		regval_ctr_addvalue( printer_data->keys[key_index].values, valuename, type, (const char *)data_p, size );
 
 		SAFE_FREE(data_p); /* 'B' option to tdbpack does a malloc() */
 
-		DEBUG(8,("specific: [%s:%s], len: %d\n", keyname, valuename, size));
 	}
 
 	return len;
Index: samba-3.0.24/source/rpc_server/srv_spoolss.c
===================================================================
--- samba-3.0.24.orig/source/rpc_server/srv_spoolss.c	2006-04-19 21:29:27.000000000 -0500
+++ samba-3.0.24/source/rpc_server/srv_spoolss.c	2007-02-15 11:02:09.000000000 -0600
@@ -1477,6 +1477,15 @@
 	ZERO_STRUCT(r_u);
 	
 	if(!spoolss_io_q_addprinterdriverex("", &q_u, data, 0)) {
+		if (q_u.level != 3 && q_u.level != 6) {
+			/* Clever hack from Martin Zielinski <mz at seh.de>
+			 * to allow downgrade from level 8 (Vista).
+			 */
+			DEBUG(3,("api_spoolss_addprinterdriverex: unknown SPOOL_Q_ADDPRINTERDRIVEREX level %u.\n",
+				(unsigned int)q_u.level ));
+			setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_INVALID_TAG));
+			return True;
+		}
 		DEBUG(0,("spoolss_io_q_addprinterdriverex: unable to unmarshall SPOOL_Q_ADDPRINTERDRIVEREX.\n"));
 		return False;
 	}
Index: samba-3.0.24/source/rpc_parse/parse_spoolss.c
===================================================================
--- samba-3.0.24.orig/source/rpc_parse/parse_spoolss.c	2007-02-15 11:02:19.000000000 -0600
+++ samba-3.0.24/source/rpc_parse/parse_spoolss.c	2007-02-15 11:02:25.000000000 -0600
@@ -3893,7 +3893,16 @@
 		}
 		case 3:
 		{
-			ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
+			/* FIXME ! Our parsing here is wrong I think,
+			 * but for a level3 it makes no sense for
+			 * ptr_sec_desc to be NULL. JRA. Based on
+			 * a Vista sniff from Martin Zielinski <mz at seh.de>.
+			 */
+			if (UNMARSHALLING(ps)) {
+				ptr_sec_desc = 1;
+			} else {
+				ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
+			}
 			break;
 		}
 	}
Index: samba-3.0.24/source/smbd/posix_acls.c
===================================================================
--- samba-3.0.24.orig/source/smbd/posix_acls.c	2007-02-08 08:11:29.000000000 -0600
+++ samba-3.0.24/source/smbd/posix_acls.c	2007-02-08 08:12:02.000000000 -0600
@@ -655,6 +655,7 @@
 	}
 	return 0;
 }
+
 /****************************************************************************
  Function to create owner and group SIDs from a SMB_STRUCT_STAT.
 ****************************************************************************/
@@ -666,6 +667,27 @@
 }
 
 /****************************************************************************
+ Is the identity in two ACEs equal ? Check both SID and uid/gid.
+****************************************************************************/
+
+static BOOL identity_in_ace_equal(canon_ace *ace1, canon_ace *ace2)
+{
+	if (sid_equal(&ace1->trustee, &ace2->trustee)) {
+		return True;
+	}
+	if (ace1->owner_type == ace2->owner_type) {
+		if (ace1->owner_type == UID_ACE &&
+				ace1->unix_ug.uid == ace2->unix_ug.uid) {
+			return True;
+		} else if (ace1->owner_type == GID_ACE &&
+				ace1->unix_ug.gid == ace2->unix_ug.gid) {
+			return True;
+		}
+	}
+	return False;
+}
+
+/****************************************************************************
  Merge aces with a common sid - if both are allow or deny, OR the permissions together and
  delete the second one. If the first is deny, mask the permissions off and delete the allow
  if the permissions become zero, delete the deny if the permissions are non zero.
@@ -692,7 +714,7 @@
 
 			curr_ace_next = curr_ace->next; /* Save the link in case of delete. */
 
-			if (sid_equal(&curr_ace->trustee, &curr_ace_outer->trustee) &&
+			if (identity_in_ace_equal(curr_ace, curr_ace_outer) &&
 				(curr_ace->attr == curr_ace_outer->attr)) {
 
 				if( DEBUGLVL( 10 )) {
@@ -732,7 +754,7 @@
 			 * we've put on the ACL, we know the deny must be the first one.
 			 */
 
-			if (sid_equal(&curr_ace->trustee, &curr_ace_outer->trustee) &&
+			if (identity_in_ace_equal(curr_ace, curr_ace_outer) &&
 				(curr_ace_outer->attr == DENY_ACE) && (curr_ace->attr == ALLOW_ACE)) {
 
 				if( DEBUGLVL( 10 )) {
Index: samba-3.0.24/source/include/smb.h
===================================================================
--- samba-3.0.24.orig/source/include/smb.h	2007-02-08 15:27:50.000000000 -0600
+++ samba-3.0.24/source/include/smb.h	2007-02-08 15:31:14.000000000 -0600
@@ -1436,6 +1436,7 @@
 #define FLAGS2_LONG_PATH_COMPONENTS    0x0001
 #define FLAGS2_EXTENDED_ATTRIBUTES     0x0002
 #define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
+#define FLAGS2_UNKNOWN_BIT4            0x0010
 #define FLAGS2_IS_LONG_NAME            0x0040
 #define FLAGS2_EXTENDED_SECURITY       0x0800 
 #define FLAGS2_DFS_PATHNAMES           0x1000
@@ -1499,7 +1500,8 @@
 
 /* Remote architectures we know about. */
 enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
-			RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA, RA_CIFSFS};
+			RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_VISTA,
+			RA_SAMBA, RA_CIFSFS};
 
 /* case handling */
 enum case_handling {CASE_LOWER,CASE_UPPER};
Index: samba-3.0.24/source/smbd/negprot.c
===================================================================
--- samba-3.0.24.orig/source/smbd/negprot.c	2007-02-08 15:27:50.000000000 -0600
+++ samba-3.0.24/source/smbd/negprot.c	2007-02-08 15:42:10.000000000 -0600
@@ -263,6 +263,16 @@
 
 	global_encrypted_passwords_negotiated = lp_encrypted_passwords();
 
+	/* Check the flags field to see if this is Vista.
+	   WinXP sets it and Vista does not. But we have to 
+	   distinguish from NT which doesn't set it either. */
+
+	if ( (SVAL(inbuf, smb_flg2) & FLAGS2_EXTENDED_SECURITY) &&
+		((SVAL(inbuf, smb_flg2) & FLAGS2_UNKNOWN_BIT4) == 0) ) 
+	{
+		set_remote_arch( RA_VISTA );		
+	}
+
 	/* do spnego in user level security if the client
 	   supports it and we can do encrypted passwords */
 	
@@ -393,6 +403,15 @@
 protocol [LANMAN2.1]
 protocol [NT LM 0.12]
 
+Vista:
+protocol [PC NETWORK PROGRAM 1.0]
+protocol [LANMAN1.0]
+protocol [Windows for Workgroups 3.1a]
+protocol [LM1.2X002]
+protocol [LANMAN2.1]
+protocol [NT LM 0.12]
+protocol [SMB 2.001]
+
 OS/2:
 protocol [PC NETWORK PROGRAM 1.0]
 protocol [XENIX CORE]
@@ -406,18 +425,19 @@
   *
   * This appears to be the matrix of which protocol is used by which
   * MS product.
-       Protocol                       WfWg    Win95   WinNT  Win2K  OS/2
-       PC NETWORK PROGRAM 1.0          1       1       1      1      1
+       Protocol                       WfWg    Win95   WinNT  Win2K  OS/2 Vista
+       PC NETWORK PROGRAM 1.0          1       1       1      1      1     1
        XENIX CORE                                      2             2
        MICROSOFT NETWORKS 3.0          2       2       
        DOS LM1.2X002                   3       3       
        MICROSOFT NETWORKS 1.03                         3
        DOS LANMAN2.1                   4       4       
-       LANMAN1.0                                       4      2      3
-       Windows for Workgroups 3.1a     5       5       5      3
-       LM1.2X002                                       6      4      4
-       LANMAN2.1                                       7      5      5
-       NT LM 0.12                              6       8      6
+       LANMAN1.0                                       4      2      3     2
+       Windows for Workgroups 3.1a     5       5       5      3            3
+       LM1.2X002                                       6      4      4     4
+       LANMAN2.1                                       7      5      5     5
+       NT LM 0.12                              6       8      6            6
+       SMB 2.001                                                           7
   *
   *  tim at fsg.com 09/29/95
   *  Win2K added by matty 17/7/99
@@ -430,6 +450,7 @@
 #define ARCH_OS2      0x14     /* Again OS/2 is like NT */
 #define ARCH_SAMBA    0x20
 #define ARCH_CIFSFS   0x40
+#define ARCH_VISTA    0x8C     /* Vista is like XP/2K */
  
 #define ARCH_ALL      0x7F
  
@@ -493,6 +514,8 @@
 			arch &= ( ARCH_WFWG | ARCH_WIN95 );
 		else if (strcsequal(p,"NT LM 0.12"))
 			arch &= ( ARCH_WIN95 | ARCH_WINNT | ARCH_WIN2K | ARCH_CIFSFS);
+		else if (strcsequal(p,"SMB 2.001"))
+			arch = ARCH_VISTA;		
 		else if (strcsequal(p,"LANMAN2.1"))
 			arch &= ( ARCH_WINNT | ARCH_WIN2K | ARCH_OS2 );
 		else if (strcsequal(p,"LM1.2X002"))
@@ -537,7 +560,13 @@
 				set_remote_arch(RA_WINNT);
 			break;
 		case ARCH_WIN2K:
-			set_remote_arch(RA_WIN2K);
+			/* Vista may have been set in the negprot so don't 
+			   override it here */
+			if ( get_remote_arch() != RA_VISTA )
+				set_remote_arch(RA_WIN2K);
+			break;
+		case ARCH_VISTA:
+			set_remote_arch(RA_VISTA);
 			break;
 		case ARCH_OS2:
 			set_remote_arch(RA_OS2);
Index: samba-3.0.24/source/lib/util.c
===================================================================
--- samba-3.0.24.orig/source/lib/util.c	2007-02-08 15:27:50.000000000 -0600
+++ samba-3.0.24/source/lib/util.c	2007-02-08 15:31:14.000000000 -0600
@@ -2182,6 +2182,9 @@
 	case RA_WIN2K3:
 		fstrcpy(remote_arch, "Win2K3");
 		break;
+	case RA_VISTA:
+		fstrcpy(remote_arch, "Vista");
+		break;
 	case RA_SAMBA:
 		fstrcpy(remote_arch,"Samba");
 		break;
Index: samba-3.0.24/source/smbd/msdfs.c
===================================================================
--- samba-3.0.24.orig/source/smbd/msdfs.c	2007-02-04 12:59:13.000000000 -0600
+++ samba-3.0.24/source/smbd/msdfs.c	2007-02-08 15:54:49.000000000 -0600
@@ -832,9 +832,13 @@
 
 	/* create the referral depeding on version */
 	DEBUG(10,("max_referral_level :%d\n",max_referral_level));
-	if(max_referral_level<2 || max_referral_level>3) {
+
+	if (max_referral_level < 2) {
 		max_referral_level = 2;
 	}
+	if (max_referral_level > 3) {
+		max_referral_level = 3;
+	}
 
 	switch(max_referral_level) {
 	case 2:
Index: samba-3.0.24/source/lib/dummysmbd.c
===================================================================
--- samba-3.0.24.orig/source/lib/dummysmbd.c	2006-04-19 21:29:23.000000000 -0500
+++ samba-3.0.24/source/lib/dummysmbd.c	2007-02-08 20:15:04.000000000 -0600
@@ -38,3 +38,9 @@
 {
 	return False;
 }
+
+NTSTATUS can_delete_directory(struct connection_struct *conn,
+                                const char *dirname)
+{
+	return NT_STATUS_OK;
+}
Index: samba-3.0.24/source/locking/locking.c
===================================================================
--- samba-3.0.24.orig/source/locking/locking.c	2007-02-04 12:59:23.000000000 -0600
+++ samba-3.0.24/source/locking/locking.c	2007-02-08 20:15:04.000000000 -0600
@@ -1166,6 +1166,11 @@
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
+	/* Don't allow delete on close for non-empty directories. */
+	if (fsp->is_directory) {
+		return can_delete_directory(fsp->conn, fsp->fsp_name);
+	}
+
 	return NT_STATUS_OK;
 }
 
Index: samba-3.0.24/source/smbd/dir.c
===================================================================
--- samba-3.0.24.orig/source/smbd/dir.c	2007-02-04 12:59:13.000000000 -0600
+++ samba-3.0.24/source/smbd/dir.c	2007-02-08 20:15:04.000000000 -0600
@@ -1255,3 +1255,42 @@
 	}
 	return False;
 }
+
+/*****************************************************************
+ Is this directory empty ?
+*****************************************************************/
+
+NTSTATUS can_delete_directory(struct connection_struct *conn,
+				const char *dirname)
+{
+	NTSTATUS status = NT_STATUS_OK;
+	long dirpos = 0;
+	const char *dname;
+	struct smb_Dir *dir_hnd = OpenDir(conn, dirname, NULL, 0);
+
+	if (!dir_hnd) {
+		return map_nt_error_from_unix(errno);
+	}
+
+	while ((dname = ReadDirName(dir_hnd,&dirpos))) {
+		SMB_STRUCT_STAT st;
+
+		/* Quick check for "." and ".." */
+		if (dname[0] == '.') {
+			if (!dname[1] || (dname[1] == '.' && !dname[2])) {
+				continue;
+			}
+		}
+
+		if (!is_visible_file(conn, dirname, dname, &st, True)) {
+			continue;
+		}
+
+		DEBUG(10,("can_delete_directory: got name %s - can't delete\n", dname ));
+		status = NT_STATUS_DIRECTORY_NOT_EMPTY;
+		break;
+	}
+	CloseDir(dir_hnd);
+
+	return status;
+}

samba-3.0.24-vista_msdfs_errcodes.patch:
 rpc_server/srv_dfs_nt.c |    6 ++---
 smbd/msdfs.c            |   57 ++++++++++++++++++++++++++++--------------------
 smbd/trans2.c           |    5 ++--
 3 files changed, 40 insertions(+), 28 deletions(-)

--- NEW FILE samba-3.0.24-vista_msdfs_errcodes.patch ---
diff -uPr samba-3.0.24/source/rpc_server/srv_dfs_nt.c samba-3.0.24.msdfs/source/rpc_server/srv_dfs_nt.c
--- samba-3.0.24/source/rpc_server/srv_dfs_nt.c	2007-02-04 13:59:21.000000000 -0500
+++ samba-3.0.24.msdfs/source/rpc_server/srv_dfs_nt.c	2007-04-05 13:23:04.000000000 -0400
@@ -67,7 +67,7 @@
 	pstrcat(altpath, sharename);
 
 	/* The following call can change the cwd. */
-	if(get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL)) {
+	if(NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL))) {
 		exists = True;
 		jn.referral_count += 1;
 		old_referral_list = jn.referral_list;
@@ -137,7 +137,7 @@
 	DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
 		dfspath, servername, sharename));
 
-	if(!get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL)) {
+	if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, dfspath, &jn, NULL, NULL))) {
 		return WERR_DFS_NO_SUCH_VOL;
 	}
 
@@ -353,7 +353,7 @@
 		return WERR_DFS_NO_SUCH_SERVER;
   
 	/* The following call can change the cwd. */
-	if(!get_referred_path(p->mem_ctx, path, &jn, &consumedcnt, NULL) || consumedcnt < strlen(path)) {
+	if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, path, &jn, &consumedcnt, NULL)) || consumedcnt < strlen(path)) {
 		vfs_ChDir(p->conn,p->conn->connectpath);
 		return WERR_DFS_NO_SUCH_VOL;
 	}
diff -uPr samba-3.0.24/source/smbd/msdfs.c samba-3.0.24.msdfs/source/smbd/msdfs.c
--- samba-3.0.24/source/smbd/msdfs.c	2007-02-04 13:59:13.000000000 -0500
+++ samba-3.0.24.msdfs/source/smbd/msdfs.c	2007-04-05 12:58:18.000000000 -0400
@@ -129,7 +129,7 @@
  Note this CHANGES CWD !!!! JRA.
 *********************************************************/
 
-static BOOL create_conn_struct(connection_struct *conn, int snum, char *path)
+static NTSTATUS create_conn_struct(connection_struct *conn, int snum, char *path)
 {
 	pstring connpath;
 
@@ -143,15 +143,16 @@
 	
         if ( (conn->mem_ctx=talloc_init("connection_struct")) == NULL ) {
                 DEBUG(0,("talloc_init(connection_struct) failed!\n"));
-                return False;
+                return NT_STATUS_NO_MEMORY;
         }
 	
 	set_conn_connectpath(conn, connpath);
 
 	if (!smbd_vfs_init(conn)) {
+		NTSTATUS status = map_nt_error_from_unix(errno);
 		DEBUG(0,("create_conn_struct: smbd_vfs_init failed.\n"));
 		conn_free_internal(conn);
-		return False;
+		return status;
 	}
 
 	/*
@@ -161,13 +162,14 @@
 	 */
 
 	if (vfs_ChDir(conn,conn->connectpath) != 0) {
+		NTSTATUS status = map_nt_error_from_unix(errno);
 		DEBUG(3,("create_conn_struct: Can't ChDir to new conn path %s. Error was %s\n",
 					conn->connectpath, strerror(errno) ));
 		conn_free_internal(conn);
-		return False;
+		return status;
 	}
 
-	return True;
+	return NT_STATUS_OK;
 }
 
 /**********************************************************************
@@ -478,7 +480,7 @@
  junction_map structure.
 **********************************************************************/
 
-BOOL get_referred_path(TALLOC_CTX *ctx, char *pathname, struct junction_map *jucn,
+NTSTATUS get_referred_path(TALLOC_CTX *ctx, char *pathname, struct junction_map *jucn,
 		       int *consumedcntp, BOOL *self_referralp)
 {
 	struct dfs_path dp;
@@ -487,11 +489,11 @@
 	struct connection_struct *conn = &conns;
 	pstring conn_path;
 	int snum;
-	BOOL ret = False;
+	NTSTATUS status = NT_STATUS_NOT_FOUND;
 	BOOL self_referral = False;
 
 	if (!pathname || !jucn) {
-		return False;
+		return NT_STATUS_NOT_FOUND;
 	}
 
 	ZERO_STRUCT(conns);
@@ -508,7 +510,7 @@
 	if (!is_myname_or_ipaddr(dp.hostname)) {
 		DEBUG(3, ("get_referred_path: Invalid hostname %s in path %s\n",
 			dp.hostname, pathname));
-		return False;
+		return NT_STATUS_NOT_FOUND;
 	}
 
 	pstrcpy(jucn->service_name, dp.servicename);
@@ -518,14 +520,14 @@
 	snum = lp_servicenumber(jucn->service_name);
 	if(snum < 0) {
 		if ((snum = find_service(jucn->service_name)) < 0) {
-			return False;
+			return NT_STATUS_NOT_FOUND;
 		}
 	}
 
 	if (!lp_msdfs_root(snum)) {
 		DEBUG(3,("get_referred_path: .%s. in dfs path %s is not a dfs root.\n",
 			 dp.servicename, pathname));
-		goto out;
+		return NT_STATUS_NOT_FOUND;
 	}
 
 	/*
@@ -540,13 +542,17 @@
 		struct referral* ref;
 
 		if (*lp_msdfs_proxy(snum) == '\0') {
-			return self_ref(ctx, pathname, jucn, consumedcntp, self_referralp);
+			if (self_ref(ctx, pathname, jucn, consumedcntp, self_referralp)) {
+				return NT_STATUS_OK;
+			} else {
+				return NT_STATUS_NOT_FOUND;
+			}
 		}
 
 		jucn->referral_count = 1;
 		if ((ref = TALLOC_P(ctx, struct referral)) == NULL) {
 			DEBUG(0, ("malloc failed for referral\n"));
-			goto out;
+			return NT_STATUS_NO_MEMORY;
 		}
 
 		pstrcpy(ref->alternate_path, lp_msdfs_proxy(snum));
@@ -559,13 +565,13 @@
 		if (consumedcntp) {
 			*consumedcntp = strlen(pathname);
 		}
-		ret = True;
-		goto out;
+		return NT_STATUS_OK;
 	}
 
 	pstrcpy(conn_path, lp_pathname(snum));
-	if (!create_conn_struct(conn, snum, conn_path)) {
-		return False;
+	status = create_conn_struct(conn, snum, conn_path);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
 	}
 
 	/* If not remote & not a self referral, return False */
@@ -585,12 +591,12 @@
 		}
 	}
 	
-	ret = True;
+	status = NT_STATUS_OK;
 
 out:
 
 	conn_free_internal(conn);
-	return ret;
+	return status;
 }
 
 static int setup_ver2_dfs_referral(char *pathname, char **ppdata, 
@@ -780,7 +786,7 @@
  Set up the Dfs referral for the dfs pathname
 ******************************************************************/
 
-int setup_dfs_referral(connection_struct *orig_conn, char *pathname, int max_referral_level, char **ppdata)
+int setup_dfs_referral(connection_struct *orig_conn, char *pathname, int max_referral_level, char **ppdata, NTSTATUS *pstatus)
 {
 	struct junction_map junction;
 	int consumedcnt;
@@ -791,6 +797,7 @@
 	TALLOC_CTX *ctx;
 
 	if (!(ctx=talloc_init("setup_dfs_referral"))) {
+		*pstatus = NT_STATUS_NO_MEMORY;
 		return -1;
 	}
 
@@ -799,6 +806,7 @@
 	/* get the junction entry */
 	if (!pathnamep) {
 		talloc_destroy(ctx);
+		*pstatus = NT_STATUS_NO_MEMORY;
 		return -1;
 	}
 
@@ -811,7 +819,8 @@
 
 	pstrcpy(buf, pathnamep);
 	/* The following call can change cwd. */
-	if (!get_referred_path(ctx, buf, &junction, &consumedcnt, &self_referral)) {
+	*pstatus = get_referred_path(ctx, buf, &junction, &consumedcnt, &self_referral);
+	if(!NT_STATUS_IS_OK(*pstatus)) {
 		vfs_ChDir(orig_conn,orig_conn->connectpath);
 		talloc_destroy(ctx);
 		return -1;
@@ -848,6 +857,7 @@
 	default:
 		DEBUG(0,("setup_dfs_referral: Invalid dfs referral version: %d\n", max_referral_level));
 		talloc_destroy(ctx);
+		*pstatus = NT_STATUS_INVALID_LEVEL;
 		return -1;
 	}
       
@@ -857,6 +867,7 @@
 	}
 
 	talloc_destroy(ctx);
+	*pstatus = NT_STATUS_OK;
 	return reply_size;
 }
 
@@ -917,7 +928,7 @@
 	safe_strcat(path, jucn->volume_name, max_pathlen-1);
 
 	pstrcpy(conn_path, lp_pathname(snum));
-	if (!create_conn_struct(conn, snum, conn_path)) {
+	if (!NT_STATUS_IS_OK(create_conn_struct(conn, snum, conn_path))) {
 		return False;
 	}
 
@@ -1031,7 +1042,7 @@
 	 * Fake up a connection struct for the VFS layer.
 	 */
 
-	if (!create_conn_struct(&conn, snum, connect_path)) {
+	if (!NT_STATUS_IS_OK(create_conn_struct(&conn, snum, connect_path))) {
 		return 0;
 	}
 
diff -uPr samba-3.0.24/source/smbd/trans2.c samba-3.0.24.msdfs/source/smbd/trans2.c
--- samba-3.0.24/source/smbd/trans2.c	2007-02-04 14:09:01.000000000 -0500
+++ samba-3.0.24.msdfs/source/smbd/trans2.c	2007-04-05 12:57:22.000000000 -0400
@@ -4934,6 +4934,7 @@
   	pstring pathname;
 	int reply_size = 0;
 	int max_referral_level;
+	NTSTATUS status = NT_STATUS_OK;
 
 	DEBUG(10,("call_trans2getdfsreferral\n"));
 
@@ -4947,8 +4948,8 @@
 		return ERROR_DOS(ERRDOS,ERRbadfunc);
 
 	srvstr_pull(inbuf, pathname, &params[2], sizeof(pathname), -1, STR_TERMINATE);
-	if((reply_size = setup_dfs_referral(conn, pathname,max_referral_level,ppdata)) < 0)
-		return UNIXERROR(ERRDOS,ERRbadfile);
+	if((reply_size = setup_dfs_referral(conn, pathname,max_referral_level,ppdata,&status)) < 0)
+		return ERROR_NT(status);
     
 	SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | FLAGS2_DFS_PATHNAMES);
 	send_trans2_replies(outbuf,bufsize,0,0,*ppdata,reply_size);


Index: samba.spec
===================================================================
RCS file: /cvs/dist/rpms/samba/FC-6/samba.spec,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- samba.spec	28 Mar 2007 16:24:27 -0000	1.75
+++ samba.spec	5 Apr 2007 20:29:50 -0000	1.76
@@ -3,7 +3,7 @@
 Summary: The Samba SMB server.
 Name: samba
 Version: 3.0.24
-Release: 3%{?dist}
+Release: 4%{?dist}
 Epoch: 0
 License: GNU GPL Version 2
 Group: System Environment/Daemons
@@ -44,7 +44,14 @@
 Patch111: samba-3.0.13-smbclient.patch
 #Patch112: samba-3.0.15pre2-bug106483.patch
 #Patch113: samba-3.0.21-warnings.patch
-Patch114: samba-3.0.24-tar_options.patch
+Patch114: samba-3.0.24-msdfs-root-no.patch
+Patch115: samba-3.0.24-vista-patchset.patch
+Patch116: samba-3.0.24-arch_macro.patch
+Patch117: samba-3.0.24-pam_winbind-fixes.patch
+Patch118: samba-3.0.24-tar_options.patch
+Patch119: samba-3.0.24-enable_pam_nss_tests.patch
+Patch120: samba-3.0.24-nss_wins.patch
+Patch121: samba-3.0.24-vista_msdfs_errcodes.patch
 
 Requires: pam >= 0:0.64 %{auth} samba-common = %{epoch}:%{version}-%{release}
 Requires: logrotate >= 0:3.4 initscripts >= 0:5.54-1 
@@ -127,7 +134,14 @@
 %patch111 -p1 -b .smbclient
 #%patch112 -p1 -b .bug106483
 #%patch113 -p1 -b .warnings
-%patch114 -p0 -b .tar_options
+%patch114 -p1 -b .dfsroot
+%patch115 -p1 -b .vista
+%patch116 -p0 -b .arch_macro
+%patch117 -p0 -b .pam_winbind
+%patch118 -p0 -b .tar_options
+%patch119 -p0 -b .pam_nss_test
+%patch120 -p0 -b .nss_wins
+%patch121 -p1 -b .msdfs
 
 # crap
 rm -f examples/VFS/.cvsignore
@@ -447,6 +461,9 @@
 %{_mandir}/man7/libsmbclient.7*
 
 %changelog
+* Thu Apr 5 2007 Simo Sorce <ssorce at redhat.com> 3.0.24-4.fc6
+- sync up patches from the rawhide packages
+
 * Wed Mar 28 2007 Simo Sorce <ssorce at redhat.com> 3.0.24-3.fc6
 - add patch for bug 176649
 




More information about the fedora-cvs-commits mailing list