[SCM] Samba Shared Repository - branch v3-2-stable updated - initial-v3-2-test-1404-g6993b61

Gerald W. Carter jerry at samba.org
Fri Jan 25 18:38:31 GMT 2008


The branch, v3-2-stable has been updated
       via  6993b6139419761c649f3ad54467a2c34f29382d (commit)
       via  f963d57096184dd9381fcc5f175150d27460ea7a (commit)
       via  5467db388355a4769e48fed7eb80920d1820f727 (commit)
       via  0d989bf90b9b75a057b572bb4369ee3126db1fb8 (commit)
       via  e57856fff2ef86481ac6770c7d010a26666d8bdd (commit)
       via  1df8f98602ac4be1d37f9c7748da8b89db80215f (commit)
       via  2c045a8c817b4ec200830c4f8b508c1cd4c4d9aa (commit)
       via  50ab169f581b4efff5185fd86d1b9ceaaf3974dd (commit)
       via  ed7322dcfa6f42743b784246f5de74d4e64b0765 (commit)
       via  ecbe08897c9cc47790f3d4f5680d25202bc0f6c3 (commit)
       via  6e17a56039be13ac1ef7004f15d154141bad7196 (commit)
       via  3a61e663e51fe620225691bc8673bf8800a36f47 (commit)
       via  22a4129fabf70e01cc638c2f7347c28201838830 (commit)
       via  913c335d21c503d32b35bf65da7b2bddf0473875 (commit)
       via  2f432842442859f98ecd263464ce02821ab10fca (commit)
      from  ef2e825e1fe5493115d2b271c2f4198e9e5b1f47 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit 6993b6139419761c649f3ad54467a2c34f29382d
Merge: ef2e825e1fe5493115d2b271c2f4198e9e5b1f47 f963d57096184dd9381fcc5f175150d27460ea7a
Author: Gerald W. Carter <jerry at samba.org>
Date:   Wed Jan 16 10:35:36 2008 -0600

    Merge branch 'v3-2-test-merge' into v3-2-stable

-----------------------------------------------------------------------

Summary of changes:
 examples/libsmbclient/Makefile             |    2 +-
 examples/libsmbclient/smbwrapper/Makefile  |    2 +-
 examples/libsmbclient/smbwrapper/wrapper.c |    1 +
 examples/libsmbclient/testacl.c            |   27 ++-
 release-scripts/create-tarball             |   85 ++++
 source/groupdb/mapping_ldb.c               |    2 +-
 source/groupdb/mapping_tdb.c               |    2 +-
 source/include/libsmbclient.h              |    2 +-
 source/librpc/ndr/libndr.h                 |   10 +-
 source/libsmb/libsmbclient.c               |  593 +++++++++++++++-------------
 source/libsmb/smbencrypt.c                 |    2 +-
 source/rpcclient/cmd_lsarpc.c              |   22 +-
 12 files changed, 458 insertions(+), 292 deletions(-)
 create mode 100755 release-scripts/create-tarball


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile
index 6500707..26b8057 100644
--- a/examples/libsmbclient/Makefile
+++ b/examples/libsmbclient/Makefile
@@ -13,7 +13,7 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
 LDFLAGS = -L/usr/local/samba/lib \
 	  -lldap -lkrb5 -lgssapi_krb5
 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so
-LIBSMBCLIENT = -lsmbclient -ldl -lresolv
+LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv
 
 TESTS=	testsmbc \
 	testacl \
diff --git a/examples/libsmbclient/smbwrapper/Makefile b/examples/libsmbclient/smbwrapper/Makefile
index c94ef8f..7264353 100644
--- a/examples/libsmbclient/smbwrapper/Makefile
+++ b/examples/libsmbclient/smbwrapper/Makefile
@@ -1,4 +1,4 @@
-LIBS = -lsmbclient -ldl
+LIBS = -lwbclient -lsmbclient -ldl
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL)
diff --git a/examples/libsmbclient/smbwrapper/wrapper.c b/examples/libsmbclient/smbwrapper/wrapper.c
index 30f9037..958e006 100644
--- a/examples/libsmbclient/smbwrapper/wrapper.c
+++ b/examples/libsmbclient/smbwrapper/wrapper.c
@@ -61,6 +61,7 @@
 #include <dirent.h>
 #include <signal.h>
 #include <stdarg.h>
+#include <string.h>
 #ifdef __USE_GNU
 # define SMBW_USE_GNU
 #endif
diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index 4d327b3..51cc90f 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -7,6 +7,7 @@
 
 enum acl_mode
 {
+    SMB_ACL_LIST,
     SMB_ACL_GET,
     SMB_ACL_SET,
     SMB_ACL_DELETE,
@@ -24,7 +25,7 @@ int main(int argc, const char *argv[])
     int debug = 0;
     int numeric = 0;
     int full_time_names = 0;
-    enum acl_mode mode = SMB_ACL_GET;
+    enum acl_mode mode = SMB_ACL_LIST;
     static char *the_acl = NULL;
     int ret;
     char *p;
@@ -149,6 +150,30 @@ int main(int argc, const char *argv[])
     
     switch(mode)
     {
+    case SMB_ACL_LIST:
+        ret = smbc_listxattr(path, value, sizeof(value)-2);
+        if (ret < 0)
+        {
+            printf("Could not get attribute list for [%s] %d: %s\n",
+                   path, errno, strerror(errno));
+            return 1;
+        }
+
+        /*
+         * The list of attributes has a series of null-terminated strings.
+         * The list of strings terminates with an extra null byte, thus two in
+         * a row.  Ensure that our buffer, which is conceivably shorter than
+         * the list of attributes, actually ends with two null bytes in a row.
+         */
+        value[sizeof(value) - 2] = '\0';
+        value[sizeof(value) - 1] = '\0';
+        printf("Supported attributes:\n");
+        for (p = value; *p; p += strlen(p) + 1)
+        {
+            printf("\t%s\n", p);
+        }
+        break;
+
     case SMB_ACL_GET:
         if (the_acl == NULL)
         {
diff --git a/release-scripts/create-tarball b/release-scripts/create-tarball
new file mode 100755
index 0000000..4592272
--- /dev/null
+++ b/release-scripts/create-tarball
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+TOPDIR="`dirname $0`/.."
+
+cd $TOPDIR
+
+echo -n "Please enter branch to cut tarball from: "
+read branch
+
+if [ "x$branch" = "x" ]; then
+   echo "You must enter a name!  Exiting...."
+   exit 1
+fi
+
+git-checkout $branch
+if [ $? -ne 0 ]; then
+   echo "Invalid branch name!  Exiting...."
+   exit 2
+fi
+
+VER_H=source/include/version.h
+(cd source && ./autogen.sh)
+
+if [ ! -f $VER_H ]; then
+   echo "Failed to find $VER_H!  Exiting...."
+   exit 1
+fi
+
+version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
+version="$version-`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`"
+version=`echo $version | sed 's/\"//g'`
+
+echo "Creating release tarball for Samba $version"
+
+/bin/rm -rf ../samba-${version}
+git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
+
+pushd ../samba-${version}
+
+echo "Enter the absolute path to the generated Samba docs directory."
+echo -n "Just hit return to exclude the docs from the generate tarball: "
+read docsdir
+
+if [ "x$docsdir" != "x" ]; then
+   if [ ! -d "$docsdir" ]; then
+      echo "$docsdir does not exist!  Exiting...."
+      exit 1
+   fi
+
+   /bin/rm -rf docs
+   mkdir docs
+   rsync -a $docsdir/ docs/
+
+   cd docs
+   /bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test
+   /bin/mv manpages-3 manpages
+   /bin/mv htmldocs/manpages-3 htmldocs/manpages
+   cd ..
+fi
+
+cd ..
+tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
+gpg --detach-sign --armor samba-${version}.tar
+gzip -9 samba-${version}.tar
+
+popd
+echo -n "Enter tag name (or hit <enter> to skip): "
+read tagname
+
+if [ "x$tagname" != "x" ]; then
+   if [ "x`git-tag -l $tagname`" != "x" ]; then
+      echo -n "Tag exists.  Do you wish to overwrite? (y/N): "
+      read answer
+
+      if [ "x$answer" != "xy" ]; then
+      	 echo "Tag creation aborted."
+	 exit 1
+      fi
+   fi
+
+   git-tag -s ${tagname}
+fi
+
+echo "Done!"
+exit 0
diff --git a/source/groupdb/mapping_ldb.c b/source/groupdb/mapping_ldb.c
index 05056ea..454fe46 100644
--- a/source/groupdb/mapping_ldb.c
+++ b/source/groupdb/mapping_ldb.c
@@ -492,7 +492,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
 		NULL
 	};
 	int ret, i;
-	NTSTATUS status;
+	NTSTATUS status = NT_STATUS_OK;
 	struct ldb_result *res=NULL;
 	struct ldb_dn *dn;
 	struct ldb_message_element *el;
diff --git a/source/groupdb/mapping_tdb.c b/source/groupdb/mapping_tdb.c
index 21a4f95..67e377c 100644
--- a/source/groupdb/mapping_tdb.c
+++ b/source/groupdb/mapping_tdb.c
@@ -394,7 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
 	char *string_sid;
 	TDB_DATA dbuf;
 	const char *p;
-	NTSTATUS status;
+	NTSTATUS status = NT_STATUS_OK;
 	TALLOC_CTX *frame;
 
 	slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index 9175b33..07242f7 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -1961,7 +1961,7 @@ int smbc_fremovexattr(int fd,
  *                            extended attributes
  *
  * @note            This function always returns all attribute names supported
- *                  by NT file systems, regardless of wether the referenced
+ *                  by NT file systems, regardless of whether the referenced
  *                  file system supports extended attributes (e.g. a Windows
  *                  2000 machine supports extended attributes if NTFS is used,
  *                  but not if FAT is used, and Windows 98 doesn't support
diff --git a/source/librpc/ndr/libndr.h b/source/librpc/ndr/libndr.h
index 6341e20..d0c2c74 100644
--- a/source/librpc/ndr/libndr.h
+++ b/source/librpc/ndr/libndr.h
@@ -149,7 +149,7 @@ struct ndr_print {
 /* set to avoid recursion in ndr_size_*() calculation */
 #define LIBNDR_FLAG_NO_NDR_SIZE		(1<<31)
 
-/* useful macro for debugging */
+/* useful macro for debugging with DEBUG */
 #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
 #define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
 #define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
@@ -157,6 +157,14 @@ struct ndr_print {
 #define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
 #define NDR_PRINT_IN_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_IN | NDR_SET_VALUES, p)
 
+/* useful macro for debugging in strings */
+#define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
+#define NDR_PRINT_UNION_STRING(ctx, type, level, p) ndr_print_union_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
+#define NDR_PRINT_FUNCTION_STRING(ctx, type, flags, p) ndr_print_function_string(ctx, (ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
+#define NDR_PRINT_BOTH_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_BOTH, p)
+#define NDR_PRINT_OUT_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_OUT, p)
+#define NDR_PRINT_IN_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_IN | NDR_SET_VALUES, p)
+
 #define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
 
 enum ndr_err_code {
diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c
index da8f1e3..fb04d14 100644
--- a/source/libsmb/libsmbclient.c
+++ b/source/libsmb/libsmbclient.c
@@ -592,13 +592,58 @@ smbc_remove_unused_server(SMBCCTX * context,
 	return 0;
 }
 
+/****************************************************************
+ * Call the auth_fn with fixed size (fstring) buffers.
+ ***************************************************************/
+
+static void call_auth_fn(TALLOC_CTX *ctx,
+			SMBCCTX *context,
+			const char *server,
+			const char *share,
+			char **pp_workgroup,
+			char **pp_username,
+			char **pp_password)
+{
+	fstring workgroup;
+	fstring username;
+	fstring password;
+
+	strlcpy(workgroup, *pp_workgroup, sizeof(workgroup));
+	strlcpy(username, *pp_username, sizeof(username));
+	strlcpy(password, *pp_password, sizeof(password));
+
+	if (context->internal->_auth_fn_with_context != NULL) {
+			(context->internal->_auth_fn_with_context)(
+				context,
+				server, share,
+				workgroup, sizeof(workgroup),
+				username, sizeof(username),
+				password, sizeof(password));
+	} else {
+		(context->callbacks.auth_fn)(
+			server, share,
+			workgroup, sizeof(workgroup),
+			username, sizeof(username),
+			password, sizeof(password));
+	}
+
+	TALLOC_FREE(*pp_workgroup);
+	TALLOC_FREE(*pp_username);
+	TALLOC_FREE(*pp_password);
+
+	*pp_workgroup = talloc_strdup(ctx, workgroup);
+	*pp_username = talloc_strdup(ctx, username);
+	*pp_password = talloc_strdup(ctx, password);
+}
+
 static SMBCSRV *
-find_server(SMBCCTX *context,
+find_server(TALLOC_CTX *ctx,
+		SMBCCTX *context,
 		const char *server,
 		const char *share,
-		char *workgroup,
-		char *username,
-		char *password)
+		char **pp_workgroup,
+		char **pp_username,
+		char **pp_password)
 {
         SMBCSRV *srv;
         int auth_called = 0;
@@ -606,22 +651,15 @@ find_server(SMBCCTX *context,
  check_server_cache:
 
 	srv = (context->callbacks.get_cached_srv_fn)(context, server, share,
-                                                     workgroup, username);
-
-	if (!auth_called && !srv && (!username[0] || !password[0])) {
-                if (context->internal->_auth_fn_with_context != NULL) {
-                        (context->internal->_auth_fn_with_context)(
-                                context,
-                                server, share,
-                                workgroup, strlen(workgroup)+1,
-                                username, strlen(username)+1,
-                                password, strlen(password)+1);
-                } else {
-                        (context->callbacks.auth_fn)(
-                                server, share,
-                                workgroup, strlen(workgroup)+1,
-                                username, strlen(username)+1,
-                                password, strlen(password)+1);
+						*pp_workgroup, *pp_username);
+
+	if (!auth_called && !srv && (!*pp_username || !(*pp_username)[0] ||
+				!*pp_password || !(*pp_password)[0])) {
+		call_auth_fn(ctx, context, server, share,
+				pp_workgroup, pp_username, pp_password);
+
+		if (!pp_workgroup || !pp_username || !pp_password) {
+			return NULL;
 		}
 
 		/*
@@ -652,12 +690,12 @@ find_server(SMBCCTX *context,
 				(context->callbacks.remove_cached_srv_fn)(context,
                                                                           srv);
 			}
-			
+
 			/*
                          * Maybe there are more cached connections to this
                          * server
                          */
-			goto check_server_cache; 
+			goto check_server_cache;
 		}
 
 		return srv;
@@ -678,13 +716,14 @@ find_server(SMBCCTX *context,
  */
 
 static SMBCSRV *
-smbc_server(SMBCCTX *context,
+smbc_server(TALLOC_CTX *ctx,
+		SMBCCTX *context,
 		bool connect_if_not_found,
 		const char *server,
 		const char *share,
-		char *workgroup,
-		char *username,
-		char *password)
+		char **pp_workgroup,
+		char **pp_username,
+		char **pp_password)
 {
 	SMBCSRV *srv=NULL;
 	struct cli_state *c;
@@ -706,8 +745,8 @@ smbc_server(SMBCCTX *context,
 	}
 
         /* Look for a cached connection */
-        srv = find_server(context, server, share,
-                          workgroup, username, password);
+        srv = find_server(ctx, context, server, share,
+                          pp_workgroup, pp_username, pp_password);
 
         /*
          * If we found a connection and we're only allowed one share per
@@ -725,20 +764,17 @@ smbc_server(SMBCCTX *context,
                  */
                 if (srv->cli->cnum == (uint16) -1) {
                         /* Ensure we have accurate auth info */
-                        if (context->internal->_auth_fn_with_context != NULL) {
-                                (context->internal->_auth_fn_with_context)(
-                                        context,
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        } else {
-                                (context->callbacks.auth_fn)(
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        }
+			call_auth_fn(ctx, context, server, share,
+				pp_workgroup, pp_username, pp_password);
+
+			if (!*pp_workgroup || !*pp_username || !*pp_password) {
+				errno = ENOMEM;
+				cli_shutdown(srv->cli);
+				srv->cli = NULL;
+				(context->callbacks.remove_cached_srv_fn)(context,
+									srv);
+				return NULL;
+			}
 
 			/*
 			 * We don't need to renegotiate encryption
@@ -746,8 +782,9 @@ smbc_server(SMBCCTX *context,
 			 * tid.
 			 */
 
-                        if (! cli_send_tconX(srv->cli, share, "?????",
-                                             password, strlen(password)+1)) {
+			if (!cli_send_tconX(srv->cli, share, "?????",
+						*pp_password,
+						strlen(*pp_password)+1)) {
 
                                 errno = smbc_errno(context, srv->cli);
                                 cli_shutdown(srv->cli);
@@ -781,6 +818,11 @@ smbc_server(SMBCCTX *context,
                 return NULL;
         }
 
+	if (!*pp_workgroup || !*pp_username || !*pp_password) {
+		errno = ENOMEM;
+		return NULL;
+	}
+
 	make_nmb_name(&calling, context->netbios_name, 0x0);
 	make_nmb_name(&called , server, 0x20);
 
@@ -877,21 +919,21 @@ smbc_server(SMBCCTX *context,
 		return NULL;
 	}
 
-        username_used = username;
+        username_used = *pp_username;
 
 	if (!NT_STATUS_IS_OK(cli_session_setup(c, username_used,
-					       password, strlen(password),
-					       password, strlen(password),
-					       workgroup))) {
+					       *pp_password, strlen(*pp_password),
+					       *pp_password, strlen(*pp_password),
+					       *pp_workgroup))) {
 
                 /* Failed.  Try an anonymous login, if allowed by flags. */
                 username_used = "";
 
                 if ((context->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON) ||
                      !NT_STATUS_IS_OK(cli_session_setup(c, username_used,
-							password, 1,
-							password, 0,
-							workgroup))) {
+							*pp_password, 1,
+							*pp_password, 0,
+							*pp_workgroup))) {
 
                         cli_shutdown(c);
                         errno = EPERM;
@@ -902,7 +944,7 @@ smbc_server(SMBCCTX *context,
 	DEBUG(4,(" session setup ok\n"));
 
 	if (!cli_send_tconX(c, share, "?????",
-			    password, strlen(password)+1)) {
+			    *pp_password, strlen(*pp_password)+1)) {
 		errno = smbc_errno(context, c);
 		cli_shutdown(c);
 		return NULL;
@@ -914,8 +956,8 @@ smbc_server(SMBCCTX *context,
 		/* Attempt UNIX smb encryption. */
 		if (!NT_STATUS_IS_OK(cli_force_encryption(c,
 						username_used,
-						password,
-						workgroup))) {
+						*pp_password,
+						*pp_workgroup))) {
 
 			/*
 			 * context->internal->_smb_encryption_level == 1
@@ -956,8 +998,9 @@ smbc_server(SMBCCTX *context,
 	/* Let the cache function set errno if it wants to */
 	errno = 0;
 	if ((context->callbacks.add_cached_srv_fn)(context, srv,
-                                                   server, share,
-                                                   workgroup, username)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list