[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-0rc2-94-g30fb237

Karolin Seeger kseeger at samba.org
Sun Jun 29 15:08:46 GMT 2008


The branch, v3-2-stable has been updated
       via  30fb2377da1848959afc1cac0f9098a4d06d9959 (commit)
       via  df391d46f55a4c2b55a4ac6e5d0284ef29ca6134 (commit)
       via  50c6a4c88bf20f711ea1ddff00ff5f6f80d0dd15 (commit)
      from  43739bd295cee3bb6b46c53b50630710ca977bf7 (commit)

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


- Log -----------------------------------------------------------------
commit 30fb2377da1848959afc1cac0f9098a4d06d9959
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jun 28 16:09:34 2008 +0200

    Fix a file descriptor leak in add_port_hook
    
    This was probably cut&paste from add_printer_hook which further down has the
    unconditional close(fd). In add_port_hook() we're not interested in the output
    of 'addport command', so don't create the out fd.
    (cherry picked from commit 0c5ca2127ac6e3c71e369242376d27429c3aee5e)

commit df391d46f55a4c2b55a4ac6e5d0284ef29ca6134
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 27 17:27:40 2008 -0700

    Fix bug #5568 net rpc trustdom add broken !
    net rpc trustdom add was broken. The default 10second timeout can be too short
    to create an account on a Samba DC (calling out to a script), error message
    reporting was poor, and more importantly the new marshalling code for
    user_info23 was broken (maps onto a user_info21 but doesn't clear the
    user_info23 struct before marshalling, leaving an uninitialized size field -
    give "alloc failure").
    Jeremy.
    (cherry picked from commit 52552623277726c2f28a992f68d8bc22982bab28)

commit 50c6a4c88bf20f711ea1ddff00ff5f6f80d0dd15
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 27 15:28:03 2008 -0700

    Fix usage message for net rpc trustdom add.
    Jeremy.
    (cherry picked from commit 55a6664cfdab9c0230836aff57ec8d2cc5bfca14)

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

Summary of changes:
 source/rpc_client/init_samr.c      |    1 +
 source/rpc_server/srv_spoolss_nt.c |    5 +----
 source/utils/net_rpc.c             |   30 +++++++++++++++++++++++++-----
 3 files changed, 27 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/rpc_client/init_samr.c b/source/rpc_client/init_samr.c
index 3b62e7e..c5d7dcd 100644
--- a/source/rpc_client/init_samr.c
+++ b/source/rpc_client/init_samr.c
@@ -413,6 +413,7 @@ void init_samr_user_info23(struct samr_UserInfo23 *r,
 			   uint8_t data[516],
 			   uint8_t pw_len)
 {
+	memset(r, '\0', sizeof(*r));
 	init_samr_user_info21(&r->info,
 			      last_logon,
 			      last_logoff,
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index f3129ac..5fff900 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/rpc_server/srv_spoolss_nt.c
@@ -6155,7 +6155,6 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
 	char *cmd = lp_addport_cmd();
 	char *command = NULL;
 	int ret;
-	int fd;
 	SE_PRIV se_printop = SE_PRINT_OPERATOR;
 	bool is_print_op = False;
 
@@ -6179,7 +6178,7 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
 	if ( is_print_op )
 		become_root();
 
-	ret = smbrun(command, &fd);
+	ret = smbrun(command, NULL);
 
 	if ( is_print_op )
 		unbecome_root();
@@ -6191,8 +6190,6 @@ WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname
 	TALLOC_FREE(command);
 
 	if ( ret != 0 ) {
-		if (fd != -1)
-			close(fd);
 		return WERR_ACCESS_DENIED;
 	}
 
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 9ff3baf..a5c2de0 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -5355,9 +5355,10 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
 	uint32 user_rid;
 	uint32_t access_granted = 0;
 	union samr_UserInfo info;
+	unsigned int orig_timeout;
 
 	if (argc != 2) {
-		d_printf("Usage: net rpc trustdom add <domain_name> <pw>\n");
+		d_printf("Usage: net rpc trustdom add <domain_name> <trust password>\n");
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
@@ -5392,6 +5393,11 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
 		goto done;
 	}
 
+        /* This call can take a long time - allow the server to time out.
+	 * 35 seconds should do it. */
+
+        orig_timeout = cli_set_timeout(pipe_hnd->cli, 35000);
+
 	/* Create trusting domain's account */
 	acb_info = ACB_NORMAL;
 	acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
@@ -5408,7 +5414,13 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
 					 &user_pol,
 					 &access_granted,
 					 &user_rid);
+
+	/* And restore our original timeout. */
+	cli_set_timeout(pipe_hnd->cli, orig_timeout);
+
 	if (!NT_STATUS_IS_OK(result)) {
+		d_printf("net rpc trustdom add: create user %s failed %s\n",
+			acct_name, nt_errstr(result));
 		goto done;
 	}
 
@@ -5478,7 +5490,7 @@ static int rpc_trustdom_add(int argc, const char **argv)
 		return run_rpc_command(NULL, PI_SAMR, 0, rpc_trustdom_add_internals,
 		                       argc, argv);
 	} else {
-		d_printf("Usage: net rpc trustdom add <domain>\n");
+		d_printf("Usage: net rpc trustdom add <domain_name> <trust password>\n");
 		return -1;
 	}
 }
@@ -5558,6 +5570,8 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
 					 &name_types);
 
 	if (!NT_STATUS_IS_OK(result)) {
+		d_printf("net rpc trustdom del: LookupNames on user %s failed %s\n",
+			acct_name, nt_errstr(result) );
 		goto done;
 	}
 
@@ -5568,6 +5582,8 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
 				      &user_pol);
 
 	if (!NT_STATUS_IS_OK(result)) {
+		d_printf("net rpc trustdom del: OpenUser on user %s failed %s\n",
+			acct_name, nt_errstr(result) );
 		goto done;
 	}
 
@@ -5583,6 +5599,8 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
 							   &user_pol,
 							   &trust_acct_sid);
 	if (!NT_STATUS_IS_OK(result)) {
+		d_printf("net rpc trustdom del: RemoveMemberFromForeignDomain on user %s failed %s\n",
+			acct_name, nt_errstr(result) );
 		goto done;
 	}
 
@@ -5592,13 +5610,15 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
 					&user_pol);
 
 	if (!NT_STATUS_IS_OK(result)) {
+		d_printf("net rpc trustdom del: DeleteUser on user %s failed %s\n",
+			acct_name, nt_errstr(result) );
 		goto done;
 	}
 
 	if (!NT_STATUS_IS_OK(result)) {
-	  DEBUG(0,("Could not set trust account password: %s\n",
-		   nt_errstr(result)));
-	  goto done;
+		d_printf("Could not set trust account password: %s\n",
+		   nt_errstr(result));
+		goto done;
 	}
 
  done:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list