[SSSD] [PATCH] intg_test: Add integration test for memory cache

Lukas Slebodnik lslebodn at redhat.com
Fri Jul 24 14:48:43 UTC 2015


On (24/07/15 16:19), Sumit Bose wrote:
>On Fri, Jul 24, 2015 at 03:35:22PM +0200, Lukas Slebodnik wrote:
>> ehlo,
>> 
>> it is a first version of integration test for memory cache.
>> The main purpose of this mail is to have some comments to the first version.
>> cwrap doesn't support properly initgroups therefore I used a ctype module
>> for calling initgroups from libnsss_sss.so.
>
>I don't mind calling initgroups from libnsss_sss.so but I think
>initgroups() support in cwrap is not strictly needed here. Since the
>initgroups() call does not return any groups you would need a
>combination of initgroups() and getgroups() in the tests.
>
getgroups()  returns the supplementary group IDs of the calling process
So I would need to fake current user to tested user.

And there was another issue initgroups is not tested by cwrap and
result of this it does not work. Initially I wanted to fix it.
So fix some bugs in cwrap which caused crash in sssd plugin but
I would need to also update getgroups or getgrouplist in cwrap
and then wait until it will be pushed in in upstream and downstream.


>getgrouplist() will return directly the list of groups for a given user
Yes it will return the list of groups for a given user iff enumeration is
enabled and enumeration does not work with stopped sssd.

There is an assumption that memory cache will return values even though
sssd is not running. I didn't want to run strace and test whether there was
a request toresponder.

>and is already supported in cmocka. Unfortunately it looks like the
>corresponding Python inferface os.getgrouplist is only added in 3.3.
>
os.getgrouplist is almost the same as pysss.getgrouplist.
I tried it but it does not work. @see explanation above.

It's true than utility "id" call getgrouplist but it also call initroups from
all plugins. And this is not implemented in cwrap yet.

#0  _nss_sss_initgroups_dyn (user=user at entry=0x60b600 "nobody",
    group=group at entry=99, start=start at entry=0x7fffffffdc58,
    size=size at entry=0x7fffffffdca0, groups=groups at entry=0x7fffffffdca8,
    limit=limit at entry=-1, errnop=0x7ffff7fd86b8)
    at src/sss_client/nss_group.c:278
#1  0x00007ffff78bd9aa in internal_getgrouplist (
    user=user at entry=0x60b600 "nobody", group=group at entry=99,
    size=size at entry=0x7fffffffdca0, groupsp=groupsp at entry=0x7fffffffdca8,
    limit=limit at entry=-1) at initgroups.c:112
#2  0x00007ffff78bdbee in getgrouplist (user=user at entry=0x60b600 "nobody",
    group=group at entry=99, groups=groups at entry=0x60cb80,
    ngroups=ngroups at entry=0x7fffffffdcf4) at initgroups.c:170
#3  0x0000000000405b58 in mgetgroups (
    username=username at entry=0x60b600 "nobody", gid=99,
    groups=groups at entry=0x7fffffffdd60) at lib/mgetgroups.c:90
#4  0x0000000000405016 in xgetgroups (
    username=username at entry=0x60b600 "nobody", gid=<optimized out>,
    groups=groups at entry=0x7fffffffdd60) at lib/xgetgroups.c:33
#5  0x000000000040232b in print_full_info (username=0x60b600 "nobody")
    at src/id.c:408
#6  main (argc=<optimized out>, argv=<optimized out>) at src/id.c:312


As you can see "id" calls getgrouplist from libc which calls
internal_getgrouplist and then initgroups from plugins (_nss_sss_initgroups_dyn)

So the fastest way how to have test initgroups memory cache was to directly
call _nss_sss_initgroups_dyn.

I'm not against fixing cwrap but it would need to be tested with glibc,
bsd libc  ... Then we can switch internal wrapper of _nss_sss_initgroups_dyn
to cwrap implementation.

LS



More information about the sssd-devel mailing list