[testlist] [PR PATCH master 21/22] s3-rpc_client: Do not give NT_STATUS_NO_MEMORY when the source string was NULL

github at samba.org github at samba.org
Mon Sep 7 00:10:48 UTC 2015


From: Andrew Bartlett <abartlet at samba.org>

Change-Id: I25a4dcc2239267ee7c219e965693027ca2981983
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 source3/rpc_client/cli_pipe.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 07fa559..ce247ff 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2873,6 +2873,12 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
 	auth->user_name = talloc_strdup(auth, cli->user_name);
 	auth->domain = talloc_strdup(auth, cli->domain);
 
+	if ((cli->user_name != NULL && auth->user_name == NULL)
+	    || (cli->domain != NULL && auth->domain == NULL)) {
+		TALLOC_FREE(result);
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	if (transport == NCACN_NP) {
 		struct smbXcli_session *session;
 
@@ -2889,11 +2895,6 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
 		}
 	}
 
-	if ((auth->user_name == NULL) || (auth->domain == NULL)) {
-		TALLOC_FREE(result);
-		return NT_STATUS_NO_MEMORY;
-	}
-
 	status = rpc_pipe_bind(result, auth);
 	if (!NT_STATUS_IS_OK(status)) {
 		int lvl = 0;
-- 
1.9.1




More information about the testlist mailing list