summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2014-08-18 14:13:39 +1200
committerAndrew Bartlett <abartlet@samba.org>2014-09-01 00:36:42 +0200
commit8485cc9448f0114510f80a1ad40b50be991bbc42 (patch)
tree4e3b3e1f1b28c84bc595b91a7fbd4dde77c17148
parent5602377fcec03ee57cb87c1600b519484c6adc10 (diff)
downloadsamba-8485cc9448f0114510f80a1ad40b50be991bbc42.tar.gz
samba-8485cc9448f0114510f80a1ad40b50be991bbc42.tar.xz
samba-8485cc9448f0114510f80a1ad40b50be991bbc42.zip
s3-rpc_client: Do not give NT_STATUS_NO_MEMORY when the source string was NULL
Change-Id: I25a4dcc2239267ee7c219e965693027ca2981983 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r--source3/rpc_client/cli_pipe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 07fa5598d1..ce247ff537 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;