]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:ldap: Fix join with don't exists machine account
authorEvgeny Sinelnikov <sin@altlinux.org>
Wed, 31 Jul 2019 19:17:20 +0000 (23:17 +0400)
committerKarolin Seeger <kseeger@samba.org>
Wed, 11 Sep 2019 10:31:14 +0000 (10:31 +0000)
Add check for requested replies of existing machine object during join
machine to domain. This solves regression fail during join with error:
"None of the information to be translated has been translated."

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

Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Sep  4 17:02:37 UTC 2019 on sn-devel-184

(cherry picked from commit ad4ef1657e9b2a088a3bfadcce196cfcceead1dc)

source3/libads/ldap.c

index e191ea792a89ffc0e49bc648c18eae719ec1124c..1f0fe9660284fcab39627d357720801aa77620d1 100644 (file)
@@ -2121,13 +2121,14 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads,
        }
 
        ret = ads_find_machine_acct(ads, &res, machine_escaped);
-       ads_msgfree(ads, res);
-       if (ADS_ERR_OK(ret)) {
+       if (ADS_ERR_OK(ret) && ads_count_replies(ads, res) == 1) {
                DBG_DEBUG("Host account for %s already exists.\n",
                                machine_escaped);
                ret = ADS_ERROR_LDAP(LDAP_ALREADY_EXISTS);
+               ads_msgfree(ads, res);
                goto done;
        }
+       ads_msgfree(ads, res);
 
        new_dn = talloc_asprintf(ctx, "cn=%s,%s", machine_escaped, org_unit);
        samAccountName = talloc_asprintf(ctx, "%s$", machine_name);