From f44e11c100751f2202be9052503bd891c626e6ed Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 26 Aug 2005 19:15:19 +0000 Subject: r9661: fallback to cn attribubte if displayName is not available (This used to be commit b1524999e0b4fc99d213fc6e56182a8fa8e88ef1) --- source3/passdb/pdb_ldap.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'source3') diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 17ff053783..99f6670653 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -3692,24 +3692,24 @@ static BOOL ldapgroup2displayentry(struct ldap_search_state *state, return False; } - /* verify that the 'cn' attribute exists */ - - vals = ldap_get_values(ld, entry, "cn"); - if ((vals == NULL) || (vals[0] == NULL)) { - DEBUG(5, ("\"cn\" not found\n")); - return False; - } - ldap_value_free(vals); - /* display name is the NT group name */ vals = ldap_get_values(ld, entry, "displayName"); - if ((vals == NULL) || (vals[0] == NULL)) + if ((vals == NULL) || (vals[0] == NULL)) { DEBUG(8, ("\"displayName\" not found\n")); - else - pull_utf8_talloc(mem_ctx, - CONST_DISCARD(char **, &result->account_name), - vals[0]); + + /* fallback to the 'cn' attribute */ + vals = ldap_get_values(ld, entry, "cn"); + if ((vals == NULL) || (vals[0] == NULL)) { + DEBUG(5, ("\"cn\" not found\n")); + return False; + } + pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, &result->account_name), vals[0]); + } + else { + pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, &result->account_name), vals[0]); + } + ldap_value_free(vals); vals = ldap_get_values(ld, entry, "description"); -- cgit