[PATCH] Fix joining specific ou (regression from #13861)
Alexander Bokovoy
ab at samba.org
Wed Sep 4 11:40:35 UTC 2019
On ke, 04 syys 2019, Günther Deschner via samba-technical wrote:
> Hi,
>
> while fixing bug #13861 we brought in a regression via
> 2044ca0e20bd3180720a82506b3af041d14b5c68 (we check only for LDAP result
> code but the result itself). Andreas has a similar patch in his larger
> join related patchset but we should first push this isolated join fix.
>
> Please review and push.
>
> Thanks,
> Guenther
>
> --
> Günther Deschner GPG-ID: 8EE11688
> Red Hat gdeschner at redhat.com
> Samba Team gd at samba.org
> From 0f6357f5fce2a25dff957ffffb236252951244fa Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Fri, 30 Aug 2019 17:19:51 +0200
> Subject: [PATCH] s3/libads: fix joining to AD and specific organizational
> units
>
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=14114
>
> The change made in 2044ca0e20bd3180720a82506b3af041d14b5c68 (for #13861)
> did only check whether the LDAP query was successful, it did not
> check for the LDAP results.
>
> Guenther
>
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
> source3/libads/ldap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
> index 4f3d43b02b1..d7741e0920b 100644
> --- a/source3/libads/ldap.c
> +++ b/source3/libads/ldap.c
> @@ -2122,7 +2122,7 @@ 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);
I wonder if the check has to be ads_count_replies(ads, res) > 0 ?
Technically, there could be a unique name but there might be names in
multiple OUs.
Other than that, RB+, please push.
> ret = ADS_ERROR_LDAP(LDAP_ALREADY_EXISTS);
> --
> 2.21.0
>
--
/ Alexander Bokovoy
More information about the samba-technical
mailing list