From 8a55edea4d87082282af815f09e229651757b560 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Mar 2003 08:40:28 +0000 Subject: Metzes change: > Hi Volker, > > if 'displayName' is not available we should fallback to 'cn' for map->nt_name > 'cn' is used as unix group name by nss_ldap. > > and if nt_name is not available we should fail (so does this patch) Volker (This used to be commit 3a7d1e72e208b9609da4ff65d9fff9179799ecac) --- source3/passdb/pdb_ldap.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 9eab2863da..f137d27cff 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2109,7 +2109,7 @@ static void free_private_data(void **vp) /* No need to free any further, as it is talloc()ed */ } -static const char *group_attr[] = {"gid", "ntSid", "ntGroupType", +static const char *group_attr[] = {"cn", "ntSid", "ntGroupType", "gidNumber", "displayName", "description", NULL }; @@ -2155,7 +2155,7 @@ static BOOL init_group_from_ldap(struct ldapsam_privates *ldap_state, } DEBUG(2, ("Entry found for group: %s\n", temp)); - map->gid = (uint32)atol(temp); + map->gid = (gid_t)atol(temp); if (!get_single_attribute(ldap_state->ldap_struct, entry, "ntSid", temp)) { @@ -2188,6 +2188,12 @@ static BOOL init_group_from_ldap(struct ldapsam_privates *ldap_state, temp)) { DEBUG(3, ("Attribute description not found\n")); temp[0] = '\0'; + if (!get_single_attribute(ldap_state->ldap_struct, entry, "cn", + temp)) { + DEBUG(0, ("Attributes cn not found either " + "for gidNumber(%i)\n",map->gid)); + return False; + } } fstrcpy(map->comment, temp); @@ -2300,8 +2306,8 @@ static NTSTATUS ldapsam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, /* TODO: Escaping of name? */ snprintf(filter, sizeof(filter)-1, - "(&(objectClass=sambaGroupMapping)(displayName=%s))", - name); + "(&(objectClass=sambaGroupMapping)(|(displayName=%s)(cn=%s)))", + name, name); return ldapsam_getgroup(methods, filter, map); } -- cgit