Rev 5312: merge from upstream in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

Michael Adam ma at sernet.de
Tue Mar 27 22:14:35 GMT 2007


At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

------------------------------------------------------------
revno: 5312
revision-id: ma at sernet.de-20070327221431-a0feaafedd193485
parent: ma at sernet.de-20070327215446-254765ac4ba52d68
parent: jra at samba.org-20070325050123-o11976514x3c03nv
committer: Michael Adam <ma at sernet.de>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Wed 2007-03-28 00:14:31 +0200
message:
  merge from upstream
modified:
  REVISION                       REVISION-20060530022625-68239662668b41c3
  source/configure.in            configure.in-20060530022626-07e74bc1e326c82d
  source/lib/replace/system/config.m4 config.m4-20060919015053-50coyc2ouwpsm77j-36
  source/lib/sysacls.c           sysacls.c-20060530022627-3b715e12cb7af15b
  source/lib/util_tdb.c          util_tdb.c-20061021025435-o3vr4t381qf9lv7e-1
  source/librpc/ndr/ndr_sec_helper.c ndr_sec_helper.c-20060908151645-5zx7mkkabpiwuown-10
  source/librpc/ndr/sid.c        sid.c-20060908151645-5zx7mkkabpiwuown-4
  source/libsmb/credentials.c    credentials.c-20060530022627-fe91ec76e47c8342
  source/modules/vfs_default.c   vfs_default.c-20060711181345-e2d073492cc4cc5d
  source/nsswitch/wbinfo.c       wbinfo.c-20060530022627-da02d48a3a15fec8
  source/passdb/passdb.c         passdb.c-20060530022627-6eeb9667474b279d
  source/printing/print_cups.c   print_cups.c-20060530022627-849502388ad9e4ac
  source/script/tests/test_posix_s3.sh test_posix_s3.sh-20060530100742-bf4d8804f7ab56c6
  source/smbd/msdfs.c            msdfs.c-20060530024146-252992a3c60c990c
  source/smbd/service.c          service.c-20060530022627-26610b9bfde9af5a
  source/smbd/trans2.c           trans2.c-20060530022627-7ce34cd85c3f02f5
  source/torture/torture.c       torture.c-20060530022628-58ac15dd2aee8532
  source/utils/pdbedit.c         pdbedit.c-20060530022628-2e85850b4961b3c7
    ------------------------------------------------------------
    merged: jra at samba.org-20070325050123-o11976514x3c03nv
    parent: vlendec at samba.org-20070324230403-vtjfa3wdoroq0df6
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sun 2007-03-25 00:01:23 -0500
    message:
      jra at samba.org (r21963)  2007-03-24 21:17:05 -0500 (Sat, 24 Mar 2007)
          
          Fix another uninitialized buffer used in test write - valgrind
          fix.
          Jeremy.
          
    ------------------------------------------------------------
    merged: vlendec at samba.org-20070324230403-vtjfa3wdoroq0df6
    parent: jra at samba.org-20070324230257-rd4yp947u680uyq2
    committer: vlendec at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 18:04:03 -0500
    message:
      vlendec at samba.org (r21962)  2007-03-24 16:29:53 -0500 (Sat, 24 Mar 2007)
          
          Make pdbedit use the configfile specified by -s
    ------------------------------------------------------------
    merged: jra at samba.org-20070324230257-rd4yp947u680uyq2
    parent: vlendec at samba.org-20070324230204-j9z9itdoeulfjw07
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 18:02:57 -0500
    message:
      jra at samba.org (r21961)  2007-03-24 13:22:20 -0500 (Sat, 24 Mar 2007)
          
          Repair bug introduced by rev. 21960.
          We need to do the initial strtok to set up the internal state.
          Jeremy.
          
    ------------------------------------------------------------
    merged: vlendec at samba.org-20070324230204-j9z9itdoeulfjw07
    parent: vlendec at samba.org-20070324230110-mdbamrn0am7uwa1i
    committer: vlendec at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 18:02:04 -0500
    message:
      vlendec at samba.org (r21960)  2007-03-24 13:14:46 -0500 (Sat, 24 Mar 2007)
          
          Fix bugs 4463,4464,4465,4466. Thanks Jason :-)
    ------------------------------------------------------------
    merged: vlendec at samba.org-20070324230110-mdbamrn0am7uwa1i
    parent: vlendec at samba.org-20070324110113-8evtpqpjlzywdr3d
    committer: vlendec at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 18:01:10 -0500
    message:
      vlendec at samba.org (r21959)  2007-03-24 13:01:39 -0500 (Sat, 24 Mar 2007)
          
          Merge a comment fix from Michael Adam -- more to come :-)
    ------------------------------------------------------------
    merged: vlendec at samba.org-20070324110113-8evtpqpjlzywdr3d
    parent: herb at samba.org-20070324050103-s69g8u1lu8m9m3or
    committer: vlendec at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 06:01:13 -0500
    message:
      vlendec at samba.org (r21958)  2007-03-24 05:32:34 -0500 (Sat, 24 Mar 2007)
          
          Fix Coverity ID 343 (dead code)
    ------------------------------------------------------------
    merged: herb at samba.org-20070324050103-s69g8u1lu8m9m3or
    parent: jra at samba.org-20070323230242-ijnpodao55lwe0mx
    committer: herb at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Sat 2007-03-24 00:01:03 -0500
    message:
      herb at samba.org (r21957)  2007-03-23 18:10:46 -0500 (Fri, 23 Mar 2007)
          
          minor formatting fix
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323230242-ijnpodao55lwe0mx
    parent: jra at samba.org-20070323230217-y3ca7psncny2rdw5
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:02:42 -0500
    message:
      jra at samba.org (r21956)  2007-03-23 17:23:09 -0500 (Fri, 23 Mar 2007)
          
          Fix bug reported by don.mccall at hp.com for platforms
          without utimes() call (only utime()).
          Jeremy.
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323230217-y3ca7psncny2rdw5
    parent: jra at samba.org-20070323230149-zeo2lylvo2f52twk
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:02:17 -0500
    message:
      jra at samba.org (r21954)  2007-03-23 17:11:26 -0500 (Fri, 23 Mar 2007)
          
          Someone misused a '!' instead of a '~' for a binary NOT
          command. Jerry, Simo, please check.
          Jeremy.
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323230149-zeo2lylvo2f52twk
    parent: jra at samba.org-20070323230125-r8nu10ekjnexnko4
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:01:49 -0500
    message:
      jra at samba.org (r21953)  2007-03-23 16:50:44 -0500 (Fri, 23 Mar 2007)
          
          One format fix, clarify a condition that the IBM
          checker was worried about.
          Jeremy.
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323230125-r8nu10ekjnexnko4
    parent: jpeach at samba.org-20070323230057-1o2gbmm0qv2brxfm
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:01:25 -0500
    message:
      jra at samba.org (r21952)  2007-03-23 16:11:08 -0500 (Fri, 23 Mar 2007)
          
          Fix critical (!) error found by IBM checker.
          Missing break statements meant that no info
          levels would ever be returned correctly from
          POSIX open/mkdir.
          Jeremy.
          
    ------------------------------------------------------------
    merged: jpeach at samba.org-20070323230057-1o2gbmm0qv2brxfm
    parent: jra at samba.org-20070323230028-da7lh5vjag1a1in7
    committer: jpeach at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:00:57 -0500
    message:
      jpeach at samba.org (r21950)  2007-03-23 14:31:11 -0500 (Fri, 23 Mar 2007)
          
          After discussion with the Apple and Linux client maintainers,
          changing the FindFirst response for the UNIX_INFO2 level to include
          a length field before the name. The name is not required to be null
          terminated. The length field does not count any null.
          
          Also add call to chflags(2) in the default VFS module so that this
          will work be default on BSD-derived platform. Add UNIX-INFO2 test
          to the build farm to get some non-BSD coverage.
          
          Jeremy and Jerry, please review for inclusion in 3.0.25.
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323230028-da7lh5vjag1a1in7
    parent: jra at samba.org-20070323170031-jaktkg4tuc30gk7c
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 18:00:28 -0500
    message:
      jra at samba.org (r21948)  2007-03-23 14:12:08 -0500 (Fri, 23 Mar 2007)
          
          Fix valgrind error in build farm samba3 smbtorture. We were
          using an uninitialized buffer for read/write tests.
          Jeremy.
          
    ------------------------------------------------------------
    merged: jra at samba.org-20070323170031-jaktkg4tuc30gk7c
    parent: metze at samba.org-20070323170018-ecfbcjwlvflc25ud
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 12:00:31 -0500
    message:
      jra at samba.org (r21947)  2007-03-23 12:00:00 -0500 (Fri, 23 Mar 2007)
          
          Fix the equivalent of memcpy(x, x, 16). Found
          by valgrind on the build farm.
          Jeremy.
          
    ------------------------------------------------------------
    merged: metze at samba.org-20070323170018-ecfbcjwlvflc25ud
    parent: jra at samba.org-20070322231625-uxwdv0hhhsrzggwg
    committer: metze at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Fri 2007-03-23 12:00:18 -0500
    message:
      metze at samba.org (r21944)  2007-03-23 05:30:51 -0500 (Fri, 23 Mar 2007)
          
          move acl header checks to the correct place only
          
          jeremy: please merge this to 3.0.25:-)
          
          metze
=== modified file 'REVISION'
--- a/REVISION	2007-03-22 23:16:25 +0000
+++ b/REVISION	2007-03-25 05:01:23 +0000
@@ -2,9 +2,9 @@
 URL: svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_3_0
 Repository Root: svn+ssh://svn.samba.org/home/svn/samba
 Repository UUID: 0c0555d6-39d7-0310-84fc-f1cc0bd64818
-Revision: 21942
+Revision: 21963
 Node Kind: directory
 Last Changed Author: jra
-Last Changed Rev: 21942
-Last Changed Date: 2007-03-22 17:15:35 -0500 (Thu, 22 Mar 2007)
+Last Changed Rev: 21963
+Last Changed Date: 2007-03-24 21:17:05 -0500 (Sat, 24 Mar 2007)
 

=== modified file 'source/configure.in'
--- a/source/configure.in	2007-03-22 23:02:00 +0000
+++ b/source/configure.in	2007-03-23 23:00:57 +0000
@@ -918,7 +918,6 @@
 AC_CHECK_HEADERS(nss.h nss_common.h nsswitch.h ns_api.h sys/security.h)
 AC_CHECK_HEADERS(syscall.h sys/syscall.h)
 
-AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
 AC_CHECK_HEADERS(sys/ea.h sys/proplist.h)
 
@@ -1226,7 +1225,8 @@
 
 AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strerror chown fchown chmod fchmod chroot link mknod mknod64)
 AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtouq __strtoull)
-AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync memset strlcpy strlcat setpgid)
+AC_CHECK_FUNCS(fstat strchr utime utimes chflags)
+AC_CHECK_FUNCS(getrlimit fsync memset strlcpy strlcat setpgid)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)

=== modified file 'source/lib/replace/system/config.m4'
--- a/source/lib/replace/system/config.m4	2006-09-19 01:51:33 +0000
+++ b/source/lib/replace/system/config.m4	2007-03-23 17:00:18 +0000
@@ -1,6 +1,7 @@
 # filesys
 AC_HEADER_DIRENT 
-AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/acl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h )
+AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h)
+AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
 
 # select
 AC_CHECK_HEADERS(sys/select.h)

=== modified file 'source/lib/sysacls.c'
--- a/source/lib/sysacls.c	2006-09-05 21:10:38 +0000
+++ b/source/lib/sysacls.c	2007-03-23 23:01:49 +0000
@@ -181,7 +181,7 @@
 					id = idbuf;
 				} else {
 					id = gr->gr_name;
-	}
+				}
 			case SMB_ACL_GROUP_OBJ:
 				tag = "group";
 				break;

=== modified file 'source/lib/util_tdb.c'
--- a/source/lib/util_tdb.c	2007-01-31 16:17:04 +0000
+++ b/source/lib/util_tdb.c	2007-03-24 23:02:04 +0000
@@ -25,18 +25,6 @@
 #undef calloc
 #undef strdup
 
-/***************************************************************
- Allow a caller to set a "alarm" flag that tdb can check to abort
- a blocking lock on SIGALRM.
-***************************************************************/
-
-static sig_atomic_t *palarm_fired;
-
-static void tdb_set_lock_alarm(sig_atomic_t *palarm)
-{
-	palarm_fired = palarm;
-}
-
 /* these are little tdb utility functions that are meant to make
    dealing with a tdb database a little less cumbersome in Samba */
 
@@ -77,7 +65,6 @@
 	/* Allow tdb_chainlock to be interrupted by an alarm. */
 	int ret;
 	gotalarm = 0;
-	tdb_set_lock_alarm(CONST_DISCARD(sig_atomic_t *, &gotalarm));
 
 	if (timeout) {
 		CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);

=== modified file 'source/librpc/ndr/ndr_sec_helper.c'
--- a/source/librpc/ndr/ndr_sec_helper.c	2006-09-08 15:20:19 +0000
+++ b/source/librpc/ndr/ndr_sec_helper.c	2007-03-24 23:02:04 +0000
@@ -130,7 +130,7 @@
 {
 	uint8_t v;
 	NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
-	*r = v;
+	*r = (enum security_ace_type)v;
 	return NT_STATUS_OK;
 }
 
@@ -559,7 +559,7 @@
 {
 	uint16_t v;
 	NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
-	*r = v;
+	*r = (enum security_acl_revision)v;
 	return NT_STATUS_OK;
 }
 
@@ -603,7 +603,7 @@
 		NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
 		NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
-		if (r->num_aces < 0 || r->num_aces > 1000) {
+		if (r->num_aces > 1000) { /* num_aces is unsigned */
 			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
 		}
 		NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
@@ -657,7 +657,7 @@
 {
 	uint8_t v;
 	NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
-	*r = v;
+	*r = (enum security_descriptor_revision)v;
 	return NT_STATUS_OK;
 }
 

=== modified file 'source/librpc/ndr/sid.c'
--- a/source/librpc/ndr/sid.c	2006-09-19 01:55:54 +0000
+++ b/source/librpc/ndr/sid.c	2007-03-24 23:02:04 +0000
@@ -211,7 +211,7 @@
 	if (ndr_flags & NDR_SCALARS) {
 		NDR_CHECK(ndr_pull_align(ndr, 4));
 		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
-		if (r->sd_size < 0 || r->sd_size > 0x40000) {
+		if (r->sd_size > 0x40000) { /* sd_size is unsigned */
 			return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
 		}
 		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));

=== modified file 'source/libsmb/credentials.c'
--- a/source/libsmb/credentials.c	2006-05-30 09:18:30 +0000
+++ b/source/libsmb/credentials.c	2007-03-23 17:00:31 +0000
@@ -101,7 +101,9 @@
 	unsigned char sum2[8];
 
 	/* Just in case this isn't already there */
-	memcpy(dc->mach_pw, mach_pw, 16);
+	if (dc->mach_pw != mach_pw) {
+		memcpy(dc->mach_pw, mach_pw, 16);
+	}
 
 	sum[0] = IVAL(clnt_chal_in->data, 0) + IVAL(srv_chal_in->data, 0);
 	sum[1] = IVAL(clnt_chal_in->data, 4) + IVAL(srv_chal_in->data, 4);

=== modified file 'source/modules/vfs_default.c'
--- a/source/modules/vfs_default.c	2007-03-09 00:13:05 +0000
+++ b/source/modules/vfs_default.c	2007-03-23 23:02:42 +0000
@@ -632,7 +632,7 @@
 	}
 #elif defined(HAVE_UTIME)
 	{
-		struct utimebuf times;
+		struct utimbuf times;
 		times.actime = convert_timespec_to_time_t(ts[0]);
 		times.modtime = convert_timespec_to_time_t(ts[1]);
 		result = utime(path, times);
@@ -905,8 +905,12 @@
 
 static int vfswrap_chflags(vfs_handle_struct *handle, const char *path, int flags)
 {
+#ifdef HAVE_CHFLAGS
+	return chflags(path, flags);
+#else
 	errno = ENOSYS;
 	return -1;
+#endif
 }
 
 static size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)

=== modified file 'source/nsswitch/wbinfo.c'
--- a/source/nsswitch/wbinfo.c	2007-02-16 21:28:13 +0000
+++ b/source/nsswitch/wbinfo.c	2007-03-24 05:01:03 +0000
@@ -1417,7 +1417,7 @@
 					  "group %s\n", string_arg);
 				goto done;
 			}
-            break;
+			break;
 		case 'r':
 			if (!wbinfo_get_usergroups(string_arg)) {
 				d_fprintf(stderr, "Could not get groups for user %s\n", 

=== modified file 'source/passdb/passdb.c'
--- a/source/passdb/passdb.c	2007-01-24 00:21:14 +0000
+++ b/source/passdb/passdb.c	2007-03-23 23:02:17 +0000
@@ -718,7 +718,7 @@
 	}
 
 	/* the 'other' acb bits not being changed here */
-	other_acb =  (pdb_get_acct_ctrl(sam_pass) & (!(ACB_WSTRUST|ACB_DOMTRUST|ACB_SVRTRUST|ACB_NORMAL)));
+	other_acb =  (pdb_get_acct_ctrl(sam_pass) & (~(ACB_WSTRUST|ACB_DOMTRUST|ACB_SVRTRUST|ACB_NORMAL)));
 	if (local_flags & LOCAL_TRUST_ACCOUNT) {
 		if (!pdb_set_acct_ctrl(sam_pass, ACB_WSTRUST | other_acb, PDB_CHANGED) ) {
 			slprintf(err_str, err_str_len - 1, "Failed to set 'trusted workstation account' flags for user %s.\n", user_name);

=== modified file 'source/printing/print_cups.c'
--- a/source/printing/print_cups.c	2007-03-16 23:00:25 +0000
+++ b/source/printing/print_cups.c	2007-03-24 11:01:13 +0000
@@ -1319,9 +1319,6 @@
 
 	}
 
-	ippDelete(response);
-	response = NULL;
-
 	ret = True;
 
  out:

=== modified file 'source/script/tests/test_posix_s3.sh'
--- a/source/script/tests/test_posix_s3.sh	2007-03-09 00:13:05 +0000
+++ b/source/script/tests/test_posix_s3.sh	2007-03-23 23:00:57 +0000
@@ -36,11 +36,16 @@
 rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC RPC-SAMBA3-SHARESEC"
 rpc="$rpc RPC-UNIXINFO RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC"
 
+# NOTE: to enable the UNIX-WHOAMI test, we need to change the default share
+# config to allow guest access. I'm not sure whether this would break other
+# tests, so leaving it alone for now -- jpeach
+unix="UNIX-INFO2"
+
 if test x$RUN_FROM_BUILD_FARM = xyes; then
 	rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
 fi
 
-tests="$base $raw $rpc"
+tests="$base $raw $rpc $unix"
 
 skipped="BASE-CHARSET BASE-DEFER_OPEN BASE-DELAYWRITE BASE-OPENATTR BASE-TCONDEV"
 skipped="$skipped RAW-ACLS RAW-COMPOSITE RAW-CONTEXT RAW-EAS"

=== modified file 'source/smbd/msdfs.c'
--- a/source/smbd/msdfs.c	2007-03-22 23:16:25 +0000
+++ b/source/smbd/msdfs.c	2007-03-24 23:02:57 +0000
@@ -249,6 +249,10 @@
 
 	pstrcpy(temp,target);
 	prot = strtok(temp,":");
+	if (!prot) {
+		DEBUG(0,("parse_msdfs_symlink: invalid path !\n"));
+		return False;
+	}
 
 	/* parse out the alternate paths */
 	while((count<MAX_REFERRAL_COUNT) &&

=== modified file 'source/smbd/service.c'
--- a/source/smbd/service.c	2007-02-27 13:56:33 +0000
+++ b/source/smbd/service.c	2007-03-23 23:01:49 +0000
@@ -915,10 +915,28 @@
 	 */
 
 	{
+		BOOL can_write = False;
 		NT_USER_TOKEN *token = conn->nt_user_token ?
-			conn->nt_user_token : vuser->nt_user_token;
-
-		BOOL can_write = share_access_check(token,
+			conn->nt_user_token :
+			(vuser ? vuser->nt_user_token : NULL);
+
+		/*
+		 * I don't believe this can happen. But the
+		 * logic above is convoluted enough to confuse
+		 * automated checkers, so be sure. JRA.
+		 */
+
+		if (token == NULL) {
+			DEBUG(0,("make_connection: connection to %s "
+				 "denied due to missing "
+				 "NT token.\n",
+				  lp_servicename(snum)));
+			conn_free(conn);
+			*status = NT_STATUS_ACCESS_DENIED;
+			return NULL;
+		}
+
+		can_write = share_access_check(token,
 						    lp_servicename(snum),
 						    FILE_WRITE_DATA);
 

=== modified file 'source/smbd/trans2.c'
--- a/source/smbd/trans2.c	2007-03-21 05:01:14 +0000
+++ b/source/smbd/trans2.c	2007-03-23 23:01:25 +0000
@@ -1601,13 +1601,17 @@
 				DEBUG(10,("get_lanman2_dir_entry: SMB_FIND_FILE_UNIX\n"));
 				p = store_file_unix_basic(conn, p,
 							NULL, &sbuf);
+				len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE);
 			} else {
 				DEBUG(10,("get_lanman2_dir_entry: SMB_FIND_FILE_UNIX_INFO2\n"));
 				p = store_file_unix_basic_info2(conn, p,
 							NULL, &sbuf);
+				nameptr = p;
+				p += 4;
+				len = srvstr_push(outbuf, p, fname, -1, 0);
+				SIVAL(nameptr, 0, len);
 			}
 
-			len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE);
 			p += len;
 			SIVAL(p,0,0); /* Ensure any padding is null. */
 
@@ -5325,17 +5329,20 @@
 	SIVAL(pdata,4,info); /* Was directory created. */
 
 	switch (info_level_return) {
-	case SMB_QUERY_FILE_UNIX_BASIC:
-		SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC);
-		SSVAL(pdata,10,0); /* Padding. */
-		store_file_unix_basic(conn, pdata + 12, fsp, psbuf);
-	case SMB_QUERY_FILE_UNIX_INFO2:
-		SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2);
-		SSVAL(pdata,10,0); /* Padding. */
-		store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf);
-	default:
-		SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED);
-		SSVAL(pdata,10,0); /* Padding. */
+		case SMB_QUERY_FILE_UNIX_BASIC:
+			SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC);
+			SSVAL(pdata,10,0); /* Padding. */
+			store_file_unix_basic(conn, pdata + 12, fsp, psbuf);
+			break;
+		case SMB_QUERY_FILE_UNIX_INFO2:
+			SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2);
+			SSVAL(pdata,10,0); /* Padding. */
+			store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf);
+			break;
+		default:
+			SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED);
+			SSVAL(pdata,10,0); /* Padding. */
+			break;
 	}
 
 	return status;
@@ -5509,17 +5516,20 @@
 	SIVAL(pdata,4,info); /* Was file created etc. */
 
 	switch (info_level_return) {
-	case SMB_QUERY_FILE_UNIX_BASIC:
-		SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC);
-		SSVAL(pdata,10,0); /* padding. */
-		store_file_unix_basic(conn, pdata + 12, fsp, psbuf);
-	case SMB_QUERY_FILE_UNIX_INFO2:
-		SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2);
-		SSVAL(pdata,10,0); /* padding. */
-		store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf);
-	default:
-		SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED);
-		SSVAL(pdata,10,0); /* padding. */
+		case SMB_QUERY_FILE_UNIX_BASIC:
+			SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC);
+			SSVAL(pdata,10,0); /* padding. */
+			store_file_unix_basic(conn, pdata + 12, fsp, psbuf);
+			break;
+		case SMB_QUERY_FILE_UNIX_INFO2:
+			SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2);
+			SSVAL(pdata,10,0); /* padding. */
+			store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf);
+			break;
+		default:
+			SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED);
+			SSVAL(pdata,10,0); /* padding. */
+			break;
 	}
 	return NT_STATUS_OK;
 }

=== modified file 'source/torture/torture.c'
--- a/source/torture/torture.c	2007-03-01 15:11:22 +0000
+++ b/source/torture/torture.c	2007-03-25 05:01:23 +0000
@@ -369,6 +369,8 @@
 	char buf[1024];
 	BOOL correct = True;
 
+	memset(buf, '\0', sizeof(buf));
+
 	fnum2 = cli_open(c, lockfname, O_RDWR | O_CREAT | O_EXCL, 
 			 DENY_NONE);
 	if (fnum2 == -1)
@@ -1049,6 +1051,8 @@
 	char buf[4];
 	BOOL ret = True;
 
+	memset(buf, '\0', sizeof(buf));
+
 	if (!torture_open_connection(&cli, 0)) {
 		return False;
 	}

=== modified file 'source/utils/pdbedit.c'
--- a/source/utils/pdbedit.c	2007-03-11 17:02:04 +0000
+++ b/source/utils/pdbedit.c	2007-03-24 23:04:03 +0000
@@ -761,6 +761,7 @@
 	static char *pwd_time_format = NULL;
 	static BOOL pw_from_stdin = False;
 	struct pdb_methods *bin, *bout, *bdef;
+	char *configfile = NULL;
 	poptContext pc;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
@@ -818,6 +819,9 @@
 		case 'C':
 			account_policy_value_set = True;
 			break;
+		case 's':
+			configfile = optarg;
+			break;
 		}
 	}
 
@@ -826,7 +830,8 @@
 	if (user_name == NULL)
 		user_name = poptGetArg(pc);
 
-	if (!lp_load(dyn_CONFIGFILE,True,False,False,True)) {
+	if (!lp_load(configfile?configfile:dyn_CONFIGFILE,
+		     True,False,False,True)) {
 		fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
 		exit(1);
 	}



More information about the samba-cvs mailing list