From c186e02b40c921d33e23c8b2f7c5f1abb235a438 Mon Sep 17 00:00:00 2001 From: Bob Campbell Date: Wed, 5 Jul 2017 11:15:04 +1200 Subject: [PATCH] samdb/cracknames: do not show recycled when a guid is desired Previously, when a GUID was desired to cracknames, it would include recycled objects as well. This would sometimes result in two objects being returned from a query which is supposed to return a unique GUID. For example, if a deleted user had the same sAMAccountName as a non-deleted user and cracknames was used to find the GUID of this account, it would return two GUIDs, and so would fail with DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12842 Signed-off-by: Bob Campbell Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- source4/dsdb/samdb/cracknames.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index 14d6a53ac16..bb25b00046e 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -7,6 +7,7 @@ Copyright (C) Stefan Metzmacher 2004 Copyright (C) Andrew Bartlett 2004-2005 Copyright (C) Matthieu Patou 2012 + Copyright (C) Catalyst .Net Ltd 2017 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -980,7 +981,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ } else { real_search_dn = ldb_get_default_basedn(sam_ctx); } - if (format_desired == DRSUAPI_DS_NAME_FORMAT_GUID){ + if (format_offered == DRSUAPI_DS_NAME_FORMAT_GUID){ dsdb_flags |= DSDB_SEARCH_SHOW_RECYCLED; } /* search with the 'phantom root' flag */ -- 2.34.1