summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-30 19:56:41 +0100
committerVolker Lendecke <vl@sernet.de>2007-11-30 22:25:01 +0100
commitac512a5bb2113aed1d41ef5479a75b8e05918876 (patch)
tree0762a522f338416c545e5ab1dbd53bc443919e59 /source3
parent1484b1d17471e33f6687e3fa3635b07a452edf03 (diff)
downloadsamba-ac512a5bb2113aed1d41ef5479a75b8e05918876.tar.gz
samba-ac512a5bb2113aed1d41ef5479a75b8e05918876.tar.bz2
samba-ac512a5bb2113aed1d41ef5479a75b8e05918876.zip
Robustness-fixes for NetJoinDomain().
Guenther (This used to be commit 2d5236cc37fe015ce9098a0ebe99cdc0ca3537ae)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/joindomain.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c
index 7c71276de6..29766e5994 100644
--- a/source3/lib/netapi/joindomain.c
+++ b/source3/lib/netapi/joindomain.c
@@ -35,6 +35,8 @@ WERROR NetJoinDomain(const char *server_name,
WERROR werr;
unsigned int old_timeout;
+ ZERO_STRUCT(encrypted_password);
+
mem_ctx = talloc_init("NetJoinDomain");
if (!mem_ctx) {
werr = WERR_NOMEM;
@@ -68,10 +70,12 @@ WERROR NetJoinDomain(const char *server_name,
goto done;
};
- encode_wkssvc_join_password_buffer(mem_ctx,
- password,
- &cli->user_session_key,
- &encrypted_password);
+ if (password) {
+ encode_wkssvc_join_password_buffer(mem_ctx,
+ password,
+ &cli->user_session_key,
+ &encrypted_password);
+ }
old_timeout = cli_set_timeout(cli, 60000);
@@ -82,13 +86,16 @@ WERROR NetJoinDomain(const char *server_name,
join_flags);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
+ goto done;
}
werr = WERR_OK;
done:
- cli_set_timeout(cli, old_timeout);
- cli_shutdown(cli);
+ if (cli) {
+ cli_set_timeout(cli, old_timeout);
+ cli_shutdown(cli);
+ }
TALLOC_FREE(mem_ctx);
return werr;