On 09/10/2014 06:13 PM, Michal Židek wrote:
On 09/10/2014 06:00 PM, Michal Židek wrote:
> 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.
Or better don't :) . I forgot to amend the first patch. Will send
new version soon.
Sorry took a little longer. Here are the patches.
Michal