From 6345220151c4b09380b0b461f51309c043052916 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 23:11:53 +0100 Subject: Only create machine account in libnetjoin when requested to. Guenther (This used to be commit bc025a3860483e8cdbd0f61579689c9edadd3af0) --- source3/libnet/libnet_join.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'source3/libnet') diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 95b643ffa6..36d5c0a889 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -138,17 +138,21 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, strlower_m(acct_name); const_acct_name = acct_name; - status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, - acct_name, ACB_WSTRUST, - 0xe005000b, &user_pol, &user_rid); - if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { - goto done; + if (r->in.join_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE) { + status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, + &domain_pol, + acct_name, ACB_WSTRUST, + 0xe005000b, &user_pol, + &user_rid); + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { + goto done; + } } - } - if (NT_STATUS_IS_OK(status)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + if (NT_STATUS_IS_OK(status)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + } } status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, -- cgit