[SCM] Samba Shared Repository - branch v3-3-stable updated - release-3-3-3-51-g496c170

Karolin Seeger kseeger at samba.org
Tue Apr 28 15:52:08 GMT 2009


The branch, v3-3-stable has been updated
       via  496c17067753943f3ffe26242ac0abc24ffeb1dc (commit)
       via  4a6a9ed212758a1fc4d566296b3579e3988398be (commit)
       via  214fa32e6c8be637078ff659d680a8f35e05634f (commit)
       via  8871f33c2bfa368c8afcbc6d6e98c5f5db615b77 (commit)
       via  0371c87b69e3c19ddfc14a91ddc7c2788360fa0a (commit)
       via  de1fad9e9a5430358d1d301f97c3d61196e55857 (commit)
       via  c1648af7dc38046c4613481bc756f79ecbb7252a (commit)
       via  a9445b5d9b181a0e570652b56667edef05013cc0 (commit)
       via  f1af57894b198da5da4a5dd0f111024de73a5aa5 (commit)
       via  33577a8785da9be8fb45abbddeeb602af25d43a1 (commit)
       via  f651f10fae1cee7cb4ef1b5ae3e18a4f9e439fcd (commit)
       via  5adcd478efb0a2415e855fb26b3dc12efd3410c8 (commit)
       via  c0aecd4aa876420a259fbc8a39ea7eff2c57460f (commit)
      from  bd2c2df4069a513ba5821b4cc2522e4eb5e0a580 (commit)

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


- Log -----------------------------------------------------------------
commit 496c17067753943f3ffe26242ac0abc24ffeb1dc
Author: Karolin Seeger <kseeger at samba.org>
Date:   Tue Apr 28 08:45:27 2009 +0200

    WHATSNEW: Update changes since 3.3.3.
    
    Karolin
    (cherry picked from commit 48d0ae00fa449a8368310b5edac708e8a3b97a3c)

commit 4a6a9ed212758a1fc4d566296b3579e3988398be
Author: Björn Jacke <bj at sernet.de>
Date:   Sat Mar 28 01:21:25 2009 +0100

    Ñ•3/configure: fix regexp for ld version recognition
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    (commit 740c2c4366badc62d017881c9484ee5153b62f94 in master)
    (commit 172ecfae44768289b98c1bafa7aa2b89dbecc312 in v3-4-test)
    (cherry picked from commit c53c875a7d205ba5f6fdb196db81e7c89d04b83b)

commit 214fa32e6c8be637078ff659d680a8f35e05634f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Apr 24 10:02:06 2009 +0200

    s3-idmap: Fix bug #6286: Call init function for builtin idmap modules before probing for them as shared modules.
    
    idmap-gurus of the world, please check.
    
    Guenther
    (cherry picked from commit 67588ca80d654183b8b7b062b9660a506a825f94)
    (cherry picked from commit a552aa1c3f67b76692e26a5560640dcfae0831b6)

commit 8871f33c2bfa368c8afcbc6d6e98c5f5db615b77
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 22 23:48:24 2009 +0200

    s3-selftest: test wbinfo --allocate-uid/gid.
    
    Guenther
    (cherry picked from commit c3843c40b5c426910a184dcef3b17283e6e224e9)

commit 0371c87b69e3c19ddfc14a91ddc7c2788360fa0a
Author: Simo Sorce <ssorce at redhat.com>
Date:   Wed Apr 22 09:12:58 2009 -0400

    Fix profile acls in some corner cases
    
    Always add back the real original owner of the directory in the ACE List after
    we steal its ACE for the Administrators group.
    (cherry picked from commit df44b4f2f6a5e83115e1e04883c94f89fdc9a28f)

commit de1fad9e9a5430358d1d301f97c3d61196e55857
Author: Simo Sorce <ssorce at redhat.com>
Date:   Wed Apr 22 06:15:21 2009 -0400

    Avoid duplicate aces
    
    When adding arbitrary aces to an nt_ace_list we need to make sure we
    are not actually adding a duplicate.
    add_or_replace_ace() takes care of doing the right thing.
    (cherry picked from commit 59ba5e05c01e9a20fbae7cce40b2301585db5c34)

commit c1648af7dc38046c4613481bc756f79ecbb7252a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 22 03:04:22 2009 -0700

    Add comment explaining the previous fix.
    Jeremy.
    (cherry picked from commit b2e0cb32c1a6f68430b36288c5d704b46d072e79)

commit a9445b5d9b181a0e570652b56667edef05013cc0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 22 02:24:27 2009 -0700

    Fix bug #6279 - winbindd crash. Cope with LDAP libraries returning LDAP_SUCCESS but not returning a result.
    Jeremy
    (cherry picked from commit b32b0d502fe0f63e82d277039dda0a6f4bb2100f)

commit f1af57894b198da5da4a5dd0f111024de73a5aa5
Author: John H Terpstra <jht at dv1000.dyn.terpstra-world.org>
Date:   Mon Apr 20 10:06:33 2009 -0500

    Added ability to revert to old modules for make revert.
    (cherry picked from commit d235881c9f3e5d14beb2ebcfa2e4a7d18e890784)

commit 33577a8785da9be8fb45abbddeeb602af25d43a1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 3 12:21:17 2009 +0200

    s3:docs: document the --request-timeout option of net
    
    metze
    (cherry picked from commit cdbbc81bad5d53397bf80898cf68d8867cf64cba)
    (cherry picked from commit 1d1e859c4e08fed1775a170ccff459f3a18e13ba)
    (cherry picked from commit 8775968526046f040a2e6ba8697d719b5e3bced8)

commit f651f10fae1cee7cb4ef1b5ae3e18a4f9e439fcd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 26 20:32:55 2009 +0100

    s3:net: add --request-timeout option
    
    metze
    (cherry picked from commit 257809558bfab3e45703cf8be76357596392a3ea)
    (cherry picked from commit e20b8706401d1a4eee0fe494825deef6ab23ab23)
    (cherry picked from commit d80e02de5714aaa650bef91767ce0775bd2392f5)

commit 5adcd478efb0a2415e855fb26b3dc12efd3410c8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 26 20:29:24 2009 +0100

    s3:net_rpc: don't shutdown a cli_state passed from the caller
    
    This fixes a crash bug if we timeout in net rpc trustdom list.
    
    metze
    (cherry picked from commit c0dfe0cf80ee50f395912b7d6aec0d87febd34c0)
    (cherry picked from commit d87563604ca7b1c18c5a84d76726c2a99dc454f8)
    (cherry picked from commit cba4214b963983730bedc792e391b5435889597a)

commit c0aecd4aa876420a259fbc8a39ea7eff2c57460f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 15 13:01:09 2009 +0200

    Do not use the file system GET_REAL_FILENAME for mangled names
    (cherry picked from commit 5a5dcd125fe236ddd93a6e56ae361fc84e306185)

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

Summary of changes:
 WHATSNEW.txt                          |   15 ++++++-
 docs-xml/manpages-3/net.8.xml         |    9 ++++
 source/configure.in                   |    2 +-
 source/libads/ldap.c                  |   10 ++++
 source/script/installmodules.sh       |    5 ++
 source/script/tests/test_wbinfo_s3.sh |    2 +
 source/smbd/filename.c                |   30 ++++++++++---
 source/smbd/posix_acls.c              |   76 ++++++++++++++++++++++++++++----
 source/utils/net.c                    |    1 +
 source/utils/net.h                    |    1 +
 source/utils/net_rpc.c                |   17 +++----
 source/utils/net_util.c               |    2 +
 source/winbindd/idmap.c               |    2 +
 13 files changed, 144 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 8d9c04a..ec9eee2 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,6 +1,6 @@
                    =============================
                    Release Notes for Samba 3.3.4
-			  April, 22  2009
+			  April, 29  2009
                    =============================
 
 
@@ -31,6 +31,7 @@ o   Jeremy Allison <jra at samba.org>
     * BUG 6089: Fix samr_OpenDomain access checks.
     * BUG 6254: Fix IPv6 PUT/GET errors to an SMB server (3.3) with
       "msdfs root" set to "yes".
+    * BUG 6279: Fix Winbind crash.
     * Allow pdbedit to change a user rid/sid.
     * When doing a cli_ulogoff don't invalidate the cnum, invalidate the vuid.
     * Don't access a freed structure when logging off and re-using a vuid.
@@ -41,6 +42,8 @@ o   Günther Deschner <gd at samba.org>
     * BUG 6238: Make sure wbcLogoffUserParams are properly initialized before
       freed.
     * BUG 6263: Fix domain logins for WinXP clients pre SP3.
+    * BUG 6286: Call init function for builtin idmap modules before probing for
+      them as shared modules.
     * Try to to fix password_expired flag handling.
     * Make sure to grey out change fields in the netdomjoin-gui when not
       running as root.
@@ -56,12 +59,22 @@ o   Volker Lendecke <vl at samba.org>
     * Use cluster-aware procid_is_me instead of comparing pids.
     * Fix smbd crash for close_on_completion.
     * Fix a memleak in an unlikely error path in change_notify_create().
+    * Do not use the file system GET_REAL_FILENAME for mangled names.
+
+
+o   Stefan Metzmacher <metze at samba.org>
+    * Fix a crash bug if we timeout in net rpc trustdom list.
+    * Add '--request-timeout' option to net.
 
 
 o   Martin Schwenke <martin at meltin.net>
     * In net_conf_import, start a transaction when importing a single share.
 
 
+o   Simo Sorce <ssorce at redhat.com>
+    * Fix writing of roaming profiles with "profile acls" set to "yes".
+
+
 ######################################################################
 Reporting bugs & Development Discussion
 #######################################
diff --git a/docs-xml/manpages-3/net.8.xml b/docs-xml/manpages-3/net.8.xml
index 1fb720a..78f798c 100644
--- a/docs-xml/manpages-3/net.8.xml
+++ b/docs-xml/manpages-3/net.8.xml
@@ -35,6 +35,7 @@
 		<arg choice="opt">-P</arg>
 		<arg choice="opt">-d debuglevel</arg>
 		<arg choice="opt">-V</arg>
+		<arg choice="opt">--request-timeout seconds</arg>
 	</cmdsynopsis>
 </refsynopsisdiv>
 
@@ -125,6 +126,14 @@
 		</para></listitem>
 		</varlistentry>
 
+		<varlistentry>
+		<term>--request-timeout 30</term>
+		<listitem><para>
+		Let client requests timeout after 30 seconds the default is 10
+		seconds.
+		</para></listitem>
+		</varlistentry>
+
 		&stdarg.server.debug;
 	</variablelist>
 </refsect1>
diff --git a/source/configure.in b/source/configure.in
index 8a1f7fc..68b4119 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -250,7 +250,7 @@ if test "$ac_cv_prog_gnu_ld" = "yes"; then
         else
            AC_MSG_CHECKING(GNU ld release version)
            changequote(,)dnl
-           ac_cv_gnu_ld_vernr=`echo $ac_cv_gnu_ld_version | sed -n 's,^.*[^0-9\.]\+\([1-9][0-9]*\.[0-9][0-9]*\).*$,\1,p'`
+           ac_cv_gnu_ld_vernr=`echo $ac_cv_gnu_ld_version | sed -n 's,^[^0-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*$,\1,p'`
            ac_cv_gnu_ld_vernr_major=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 1`
            ac_cv_gnu_ld_vernr_minor=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 2`
            changequote([,])dnl
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 4fb9530..d9598e5 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -118,6 +118,16 @@ static int ldap_search_with_timeout(LDAP *ld,
 	if (gotalarm != 0)
 		return LDAP_TIMELIMIT_EXCEEDED;
 
+	/*
+	 * A bug in OpenLDAP means ldap_search_ext_s can return
+	 * LDAP_SUCCESS but with a NULL res pointer. Cope with
+	 * this. See bug #6279 for details. JRA.
+	 */
+
+	if (*res == NULL) {
+		return LDAP_TIMELIMIT_EXCEEDED;
+	}
+
 	return result;
 }
 
diff --git a/source/script/installmodules.sh b/source/script/installmodules.sh
index f70db00..127091d 100755
--- a/source/script/installmodules.sh
+++ b/source/script/installmodules.sh
@@ -29,6 +29,11 @@ mtype=`basename $LIBDIR`
 for p in $*; do
  p2=`basename $p`
  name=`echo $p2 | sed -es/${mtype}_//`
+ echo Preserving old module as $DESTDIR/$LIBDIR/$name.old
+ if [ -f $DESTDIR/$LIBDIR/$name ]; then
+   rm -f $DESTDIR/$LIBDIR/$name.old
+   mv $DESTDIR/$LIBDIR/$name $DESTDIR/$LIBDIR/$name.old
+ fi
  echo Installing $p as $DESTDIR/$LIBDIR/$name
  cp -f $p $DESTDIR/$LIBDIR/$name
  chmod $INSTALLPERMS $DESTDIR/$LIBDIR/$name
diff --git a/source/script/tests/test_wbinfo_s3.sh b/source/script/tests/test_wbinfo_s3.sh
index e3bf1b9..b24343e 100755
--- a/source/script/tests/test_wbinfo_s3.sh
+++ b/source/script/tests/test_wbinfo_s3.sh
@@ -34,6 +34,8 @@ tests="$tests:--domain-groups"
 tests="$tests:--name-to-sid=$username"
 #Didn't pass yet# tests="$tests:--user-info=$username"
 tests="$tests:--user-groups=$username"
+tests="$tests:--allocate-uid"
+tests="$tests:--allocate-gid"
 
 failed=0
 
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 003cb0f..031668f 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -33,6 +33,9 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
 				  const char *streamname,
 				  SMB_STRUCT_STAT *pst,
 				  char **path);
+static int get_real_filename_mangled(connection_struct *conn, const char *path,
+				     const char *name, TALLOC_CTX *mem_ctx,
+				     char **found_name);
 
 /****************************************************************************
  Mangle the 2nd name and check if it is then equal to the first name.
@@ -447,7 +450,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 			 */
 
 			if (name_has_wildcard ||
-			    (SMB_VFS_GET_REAL_FILENAME(
+			    (get_real_filename_mangled(
 				     conn, dirpath, start,
 				     talloc_tos(), &found_name) == -1)) {
 				char *unmangled;
@@ -789,15 +792,12 @@ static bool fname_equal(const char *name1, const char *name2,
  If the name looks like a mangled name then try via the mangling functions
 ****************************************************************************/
 
-int get_real_filename(connection_struct *conn, const char *path,
-		      const char *name, TALLOC_CTX *mem_ctx,
-		      char **found_name)
+static int get_real_filename_mangled(connection_struct *conn, const char *path,
+				     const char *name, TALLOC_CTX *mem_ctx,
+				     char **found_name)
 {
-	struct smb_Dir *cur_dir;
-	const char *dname;
 	bool mangled;
 	char *unmangled_name = NULL;
-	long curpos;
 
 	mangled = mangle_is_mangled(name, conn->params);
 
@@ -838,8 +838,24 @@ int get_real_filename(connection_struct *conn, const char *path,
 			/* Name is now unmangled. */
 			name = unmangled_name;
 		}
+		return get_real_filename(conn, path, name, mem_ctx,
+					 found_name);
 	}
 
+	return SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx,
+					 found_name);
+}
+
+int get_real_filename(connection_struct *conn, const char *path,
+		      const char *name, TALLOC_CTX *mem_ctx,
+		      char **found_name)
+{
+	struct smb_Dir *cur_dir;
+	const char *dname;
+	bool mangled;
+	char *unmangled_name = NULL;
+	long curpos;
+
 	/* open the directory */
 	if (!(cur_dir = OpenDir(talloc_tos(), conn, path, NULL, 0))) {
 		DEBUG(3,("scan dir didn't open dir [%s]\n",path));
diff --git a/source/smbd/posix_acls.c b/source/smbd/posix_acls.c
index 16acca4..a319c58 100644
--- a/source/smbd/posix_acls.c
+++ b/source/smbd/posix_acls.c
@@ -3,6 +3,7 @@
    SMB NT Security Descriptor / Unix permission conversion.
    Copyright (C) Jeremy Allison 1994-2000.
    Copyright (C) Andreas Gruenbacher 2002.
+   Copyright (C) Simo Sorce <idra at samba.org> 2009.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -2814,6 +2815,42 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces)
 	return num_aces;
 }
 
+/*
+ * Add or Replace ACE entry.
+ * In some cases we need to add a specific ACE for compatibility reasons.
+ * When doing that we must make sure we are not actually creating a duplicate
+ * entry. So we need to search whether an ACE entry already exist and eventually
+ * replacce the access mask, or add a completely new entry if none was found.
+ *
+ * This function assumes the array has enough space to add a new entry without
+ * any reallocation of memory.
+ */
+
+static void add_or_replace_ace(SEC_ACE *nt_ace_list, size_t *num_aces,
+				const DOM_SID *sid, enum security_ace_type type,
+				uint32_t mask, uint8_t flags)
+{
+	int i;
+
+	/* first search for a duplicate */
+	for (i = 0; i < *num_aces; i++) {
+		if (sid_equal(&nt_ace_list[i].trustee, sid) &&
+		    (nt_ace_list[i].flags == flags)) break;
+	}
+
+	if (i < *num_aces) { /* found */
+		nt_ace_list[i].type = type;
+		nt_ace_list[i].access_mask = mask;
+		DEBUG(10, ("Replacing ACE %d with SID %s and flags %02x\n",
+			   i, sid_string_dbg(sid), flags));
+		return;
+	}
+
+	/* not found, append it */
+	init_sec_ace(&nt_ace_list[(*num_aces)++], sid, type, mask, flags);
+}
+
+
 /****************************************************************************
  Reply to query a security descriptor from an fsp. If it succeeds it allocates
  the space for the return elements and returns the size needed to return the
@@ -2841,19 +2878,22 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 	canon_ace *dir_ace = NULL;
 	SEC_ACE *nt_ace_list = NULL;
 	size_t num_profile_acls = 0;
+	DOM_SID orig_owner_sid;
 	SEC_DESC *psd = NULL;
+	int i;
 
 	/*
 	 * Get the owner, group and world SIDs.
 	 */
 
+	create_file_sids(sbuf, &owner_sid, &group_sid);
+
 	if (lp_profile_acls(SNUM(conn))) {
 		/* For WXP SP1 the owner must be administrators. */
+		sid_copy(&orig_owner_sid, &owner_sid);
 		sid_copy(&owner_sid, &global_sid_Builtin_Administrators);
 		sid_copy(&group_sid, &global_sid_Builtin_Users);
-		num_profile_acls = 2;
-	} else {
-		create_file_sids(sbuf, &owner_sid, &group_sid);
+		num_profile_acls = 3;
 	}
 
 	if ((security_info & DACL_SECURITY_INFORMATION) && !(security_info & PROTECTED_DACL_SECURITY_INFORMATION)) {
@@ -2975,10 +3015,10 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 			/* The User must have access to a profile share - even
 			 * if we can't map the SID. */
 			if (lp_profile_acls(SNUM(conn))) {
-				init_sec_ace(&nt_ace_list[num_aces++],
-						&global_sid_Builtin_Users,
-						SEC_ACE_TYPE_ACCESS_ALLOWED,
-						FILE_GENERIC_ALL, 0);
+				add_or_replace_ace(nt_ace_list, &num_aces,
+						   &global_sid_Builtin_Users,
+						   SEC_ACE_TYPE_ACCESS_ALLOWED,
+						   FILE_GENERIC_ALL, 0);
 			}
 
 			for (ace = dir_ace; ace != NULL; ace = ace->next) {
@@ -3000,9 +3040,13 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 			/* The User must have access to a profile share - even
 			 * if we can't map the SID. */
 			if (lp_profile_acls(SNUM(conn))) {
-				init_sec_ace(&nt_ace_list[num_aces++], &global_sid_Builtin_Users, SEC_ACE_TYPE_ACCESS_ALLOWED, FILE_GENERIC_ALL,
-						SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|
-						SEC_ACE_FLAG_INHERIT_ONLY|0);
+				add_or_replace_ace(nt_ace_list, &num_aces,
+						&global_sid_Builtin_Users,
+						SEC_ACE_TYPE_ACCESS_ALLOWED,
+						FILE_GENERIC_ALL,
+						SEC_ACE_FLAG_OBJECT_INHERIT |
+						SEC_ACE_FLAG_CONTAINER_INHERIT |
+						SEC_ACE_FLAG_INHERIT_ONLY);
 			}
 
 			/*
@@ -3013,6 +3057,18 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 
 			num_aces = merge_default_aces(nt_ace_list, num_aces);
 
+			if (lp_profile_acls(SNUM(conn))) {
+				for (i = 0; i < num_aces; i++) {
+					if (sid_equal(&nt_ace_list[i].trustee, &owner_sid)) {
+						add_or_replace_ace(nt_ace_list, &num_aces,
+	    							   &orig_owner_sid,
+			    					   nt_ace_list[i].type,
+					    			   nt_ace_list[i].access_mask,
+								   nt_ace_list[i].flags);
+						break;
+					}
+				}
+			}
 		}
 
 		if (num_aces) {
diff --git a/source/utils/net.c b/source/utils/net.c
index f1a5be1..a8203b6 100644
--- a/source/utils/net.c
+++ b/source/utils/net.c
@@ -635,6 +635,7 @@ static struct functable net_func[] = {
 		{"force",	'f', POPT_ARG_NONE,   &c->opt_force},
 		{"stdin",	'i', POPT_ARG_NONE,   &c->opt_stdin},
 		{"timeout",	't', POPT_ARG_INT,    &c->opt_timeout},
+		{"request-timeout",0,POPT_ARG_INT,    &c->opt_request_timeout},
 		{"machine-pass",'P', POPT_ARG_NONE,   &c->opt_machine_pass},
 		{"kerberos",    'k', POPT_ARG_NONE,   &c->opt_kerberos},
 		{"myworkgroup", 'W', POPT_ARG_STRING, &c->opt_workgroup},
diff --git a/source/utils/net.h b/source/utils/net.h
index 2d72756..d88f962 100644
--- a/source/utils/net.h
+++ b/source/utils/net.h
@@ -43,6 +43,7 @@ struct net_context {
 	const char *opt_container;
 	int opt_flags;
 	int opt_timeout;
+	int opt_request_timeout;
 	const char *opt_target_workgroup;
 	int opt_machine_pass;
 	int opt_localgroup;
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 98605d1..8377e1c 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -120,6 +120,7 @@ int run_rpc_command(struct net_context *c,
 	NTSTATUS nt_status;
 	DOM_SID *domain_sid;
 	const char *domain_name;
+	int ret = -1;
 
 	/* make use of cli_state handed over as an argument, if possible */
 	if (!cli_arg) {
@@ -141,15 +142,13 @@ int run_rpc_command(struct net_context *c,
 
 	if (!(mem_ctx = talloc_init("run_rpc_command"))) {
 		DEBUG(0, ("talloc_init() failed\n"));
-		cli_shutdown(cli);
-		return -1;
+		goto fail;
 	}
 
 	nt_status = net_get_remote_domain_sid(cli, mem_ctx, &domain_sid,
 					      &domain_name);
 	if (!NT_STATUS_IS_OK(nt_status)) {
-		cli_shutdown(cli);
-		return -1;
+		goto fail;
 	}
 
 	if (!(conn_flags & NET_FLAGS_NO_PIPE)) {
@@ -164,8 +163,7 @@ int run_rpc_command(struct net_context *c,
 			if (!NT_STATUS_IS_OK(nt_status)) {
 				DEBUG(0, ("Could not initialise schannel netlogon pipe. Error was %s\n",
 					nt_errstr(nt_status) ));
-				cli_shutdown(cli);
-				return -1;
+				goto fail;
 			}
 		} else {
 			if (conn_flags & NET_FLAGS_SEAL) {
@@ -184,8 +182,7 @@ int run_rpc_command(struct net_context *c,
 					cli_get_pipe_name_from_iface(
 						debug_ctx(), cli, interface),
 					nt_errstr(nt_status) ));
-				cli_shutdown(cli);
-				return -1;
+				goto fail;
 			}
 		}
 	}
@@ -195,6 +192,7 @@ int run_rpc_command(struct net_context *c,
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		DEBUG(1, ("rpc command function failed! (%s)\n", nt_errstr(nt_status)));
 	} else {
+		ret = 0;
 		DEBUG(5, ("rpc command function succedded\n"));
 	}
 
@@ -204,13 +202,14 @@ int run_rpc_command(struct net_context *c,
 		}
 	}
 
+fail:
 	/* close the connection only if it was opened here */
 	if (!cli_arg) {
 		cli_shutdown(cli);
 	}
 
 	talloc_destroy(mem_ctx);
-	return (!NT_STATUS_IS_OK(nt_status));
+	return ret;
 }
 
 /**
diff --git a/source/utils/net_util.c b/source/utils/net_util.c
index ee02942..98dac4d 100644
--- a/source/utils/net_util.c
+++ b/source/utils/net_util.c
@@ -521,6 +521,8 @@ NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
 		d_fprintf(stderr, "Connection failed: %s\n",
 			  nt_errstr(nt_status));
 		cli = NULL;
+	} else if (c->opt_request_timeout) {
+		cli_set_timeout(cli, c->opt_request_timeout * 1000);
 	}
 
 done:
diff --git a/source/winbindd/idmap.c b/source/winbindd/idmap.c
index ca07f23..c097170 100644
--- a/source/winbindd/idmap.c
+++ b/source/winbindd/idmap.c
@@ -536,6 +536,8 @@ static NTSTATUS idmap_alloc_init(struct idmap_alloc_context **ctx)
 	char *modulename, *params;
 	NTSTATUS ret = NT_STATUS_NO_MEMORY;;
 
+	static_init_idmap;
+
 	if (idmap_alloc_ctx != NULL) {
 		*ctx = idmap_alloc_ctx;
 		return NT_STATUS_OK;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list