summaryrefslogtreecommitdiff
path: root/source3/libnet/libnet_join.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2019-08-13 16:34:34 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-10-09 07:06:35 +0000
commitce7762935051c862ecdd3e82d93096aac61dd292 (patch)
treee166a6ee350a8a0418ad6eb691bd3b8fbf96594a /source3/libnet/libnet_join.c
parentb755a6438022579dab1a403c81d60b1ed7efca38 (diff)
downloadsamba-ce7762935051c862ecdd3e82d93096aac61dd292.tar.gz
s3:libads: Fix creating machine account using LDAP
This implements the same behaviour as Windows. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13884 Pair-Programmed-With: Guenther Deschner <gd@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source3/libnet/libnet_join.c')
-rw-r--r--source3/libnet/libnet_join.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 3e24ba77dfd..0e7775079bb 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -338,10 +338,22 @@ static ADS_STATUS libnet_join_precreate_machine_acct(TALLOC_CTX *mem_ctx,
/* Attempt to create the machine account and bail if this fails.
Assume that the admin wants exactly what they requested */
+ if (r->in.machine_password == NULL) {
+ r->in.machine_password =
+ trust_pw_new_value(mem_ctx,
+ r->in.secure_channel_type,
+ SEC_ADS);
+ if (r->in.machine_password == NULL) {
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
+ }
+
status = ads_create_machine_acct(r->in.ads,
r->in.machine_name,
+ r->in.machine_password,
r->in.account_ou,
- r->in.desired_encryption_types);
+ r->in.desired_encryption_types,
+ r->out.dns_domain_name);
if (ADS_ERR_OK(status)) {
DEBUG(1,("machine account creation created\n"));
@@ -2675,12 +2687,11 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
if (ADS_ERR_OK(ads_status)) {
/*
- * LDAP object create succeeded, now go to the rpc
- * password set routines
+ * LDAP object creation succeeded.
*/
-
r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE;
- goto rpc_join;
+
+ return WERR_OK;
}
if (initial_account_ou != NULL) {
@@ -2694,8 +2705,6 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
DBG_INFO("Failed to pre-create account in OU %s: %s\n",
r->in.account_ou, ads_errstr(ads_status));
}
- rpc_join:
-
#endif /* HAVE_ADS */
if ((r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE) &&