s3-libnet_join: always pass down admin domain to ads layer
authorGünther Deschner <gd@samba.org>
Tue, 2 Apr 2019 11:14:06 +0000 (13:14 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 Apr 2019 09:49:52 +0000 (09:49 +0000)
Otherwise we could loose the information that a non-default domain name
has been used for admin creds.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13861

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ea29aa27cbac4253ee1701fed99a3e0811f7475d)

source3/libnet/libnet_join.c

index e052306523d48b61eaa9c3f3ab4b51085b71a114..fc7429e6a234a5dcb98d71d3101a06dc154f9a58 100644 (file)
@@ -205,7 +205,19 @@ static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
                password = r->in.machine_password;
                ccname = "MEMORY:libnet_join_machine_creds";
        } else {
+               char *p = NULL;
+
                username = r->in.admin_account;
+
+               p = strchr(r->in.admin_account, '@');
+               if (p == NULL) {
+                       username = talloc_asprintf(mem_ctx, "%s@%s",
+                                                  r->in.admin_account,
+                                                  r->in.admin_domain);
+               }
+               if (username == NULL) {
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
                password = r->in.admin_password;
 
                /*