diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-05-17 13:53:19 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2017-07-13 20:01:26 +0200 |
commit | 43cce73b9730cbdd33bd376906b55a2171688ba5 (patch) | |
tree | acfac04760c40958c5e0ca77c706b5038cf780e6 | |
parent | b76556fc88b4588c0750299161146ee8c39c5951 (diff) | |
download | samba-43cce73b9730cbdd33bd376906b55a2171688ba5.tar.gz |
s3:libnet_join: calculate r->out.account_name in libnet_join_pre_processing()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 826223cc8d36871c2bcb37fe23241f1dbe99a0db)
-rw-r--r-- | source3/libnet/libnet_join.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index e33c3838866..1e290d78570 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1122,7 +1122,6 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *netlogon_pipe = NULL; struct netlogon_creds_cli_context *netlogon_creds = NULL; struct samr_Password current_nt_hash; - const char *account_name = NULL; NTSTATUS status; status = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon, @@ -1147,16 +1146,9 @@ static NTSTATUS libnet_join_joindomain_rpc_unsecure(TALLOC_CTX *mem_ctx, /* according to WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED */ E_md4hash(r->in.admin_password, current_nt_hash.hash); - account_name = talloc_asprintf(frame, "%s$", - r->in.machine_name); - if (account_name == NULL) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } - status = rpccli_create_netlogon_creds(netlogon_pipe->desthost, r->in.domain_name, - account_name, + r->out.account_name, r->in.secure_channel_type, r->in.msg_ctx, frame, @@ -2111,6 +2103,14 @@ static WERROR libnet_join_pre_processing(TALLOC_CTX *mem_ctx, return WERR_INVALID_PARAMETER; } + r->out.account_name = talloc_asprintf(mem_ctx, "%s$", + r->in.machine_name); + if (r->out.account_name == NULL) { + libnet_join_set_error_string(mem_ctx, r, + "Unable to construct r->out.account_name"); + return WERR_NOT_ENOUGH_MEMORY; + } + if (!libnet_parse_domain_dc(mem_ctx, r->in.domain_name, &r->in.domain_name, &r->in.dc_name)) { |