[SSSD] [PATCHES] Alternative objectClass for group maps

Michal Židek mzidek at redhat.com
Wed Sep 10 16:00:56 UTC 2014


On 09/10/2014 02:49 PM, Jakub Hrozek wrote:
> 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.

Ok. I included these two changes:
1. add function to generate ORed list of objectclasses, that can be
used in filter.

2. add small static function to match objectclass.

I do not want to include more changes. It will be better to file
tickets for the enhancements that will come out of the discussion
on the list. The two added function probably be changed anyway.

See the attached patches.

Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-alternative-objectClass-to-group-attribute-maps.patch
Type: text/x-patch
Size: 3914 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20140910/cac52bce/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Use-the-alternative-objectclass-in-group-maps.patch
Type: text/x-patch
Size: 15457 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20140910/cac52bce/attachment-0001.bin>


More information about the sssd-devel mailing list