libnet_join: use sitename if it was set by pre-join detection
authorAlexander Bokovoy <ab@samba.org>
Tue, 14 Jun 2016 19:37:31 +0000 (22:37 +0300)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 15 Jun 2016 13:25:44 +0000 (15:25 +0200)
When domain member is joined to AD, we need to use the same DC to
authenticate against after the join because the machine account might
not be replicated yet to other domain controllers, including off-site.

Bug https://bugzilla.samba.org/show_bug.cgi?id=11769 dealt with
detection of the site pre-join. However, we rewrite private local
krb5.conf afterwards without taking the discovered site name into
account.

Fix this by reusing the site discovered pre-join.

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

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jun 15 15:25:44 CEST 2016 on sn-devel-144

source3/libnet/libnet_join.c

index a28864d94eb9eda6ca25202cac268c03a1604bfe..c00718306e212f15da9fd052d10bfeb43e41ef70 100644 (file)
@@ -2500,7 +2500,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
 
        create_local_private_krb5_conf_for_domain(
                r->out.dns_domain_name, r->out.netbios_domain_name,
-               NULL, smbXcli_conn_remote_sockaddr(cli->conn));
+               sitename, smbXcli_conn_remote_sockaddr(cli->conn));
 
        if (r->out.domain_is_ad &&
            !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) {