[SSSD] [PATCHES] Alternative objectClass for group maps
Jakub Hrozek
jhrozek at redhat.com
Wed Sep 10 12:49:46 UTC 2014
On Wed, Sep 10, 2014 at 01:23:15PM +0200, Michal Židek wrote:
> --- a/src/providers/ldap/sdap.c
> +++ b/src/providers/ldap/sdap.c
> @@ -348,9 +348,12 @@ int sdap_parse_entry(TALLOC_CTX *memctx,
> }
>
> for (i = 0; vals[i]; i++) {
> - /* the objectclass is always the first name in the map */
> - if (strncasecmp(map[0].name,
> - vals[i]->bv_val, vals[i]->bv_len) == 0) {
> + /* The objectclass is always the first name in the map.
> + * Alternative objectclass for groups is second. */
> + if (strncasecmp(map[0].name, vals[i]->bv_val, vals[i]->bv_len) == 0
> + || (map[1].name != NULL
> + && strncasecmp(map[1].name,
> + vals[i]->bv_val, vals[i]->bv_len) == 0)) {
> /* ok it's an entry of the right type */
> break;
> }
> @@ -630,7 +633,9 @@ errno_t sdap_parse_deref(TALLOC_CTX *mem_ctx,
>
> for (i=0; ocs[i]; i++) {
> /* the objectclass is always the first name in the map */
> - if (strcasecmp(minfo[mi].map[0].name, ocs[i]) == 0) {
> + if (strcasecmp(minfo[mi].map[0].name, ocs[i]) == 0
> + || (minfo[mi].map[1].name != NULL
> + && strcasecmp(minfo[mi].map[1].name, ocs[i]) == 0)) {
> DEBUG(SSSDBG_TRACE_ALL,
> "Found map for objectclass '%s'\n", ocs[i]);
> map = minfo[mi].map;
It would also be nice to split these two places into a separate
function. That would make migrating to a list of objectclasses easier
later.
More information about the sssd-devel
mailing list