Review Request 116881: Fix KUser::groups() and KUser::groupNames() on UNIX

Alexander Richardson arichardson.kde at googlemail.com
Tue Apr 8 08:30:11 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116881/
-----------------------------------------------------------

(Updated April 8, 2014, 10:30 a.m.)


Review request for KDE Frameworks.


Repository: kcoreaddons


Description
-------

Fix KUser::groups() and KUser::groupNames() on UNIX

If available we use getgrouplist() which returns all group IDs.
Otherwise we fall back to using getgrent() and checking whether gr_mem
contains the user. For some reason gr_mem doesn't usally contain the
users primary gid, so we add the corresponding struct group for that gid
as well.


Diffs (updated)
-----

  src/lib/CMakeLists.txt 1d17874f0da428bd34ea85ee98683f6fef620c81 
  src/lib/util/config-getgrouplist.h.cmake PRE-CREATION 
  src/lib/util/kuser_unix.cpp d1f7381a1e1d10fa1fdcd4b498a8ff007b8789e8 

Diff: https://git.reviewboard.kde.org/r/116881/diff/


Testing
-------

Returns more groups now, should fix KUserTest::testKUser() on build.kde.org


File Attachments
----------------

 old user->groups result (getgrent)
  https://git.reviewboard.kde.org/media/uploaded/files/2014/03/18/86c5e986-8098-4c50-809c-bc3e7851447a__grouplist_getgrent_old.txt
new user->groups result (getgrouplist)
  https://git.reviewboard.kde.org/media/uploaded/files/2014/03/18/59f4ecda-5c1d-4bdc-a8ec-850de761e3a3__grouplist_getgrouplist.txt
new user->groups result (getgrent + current gid)
  https://git.reviewboard.kde.org/media/uploaded/files/2014/03/18/39d0172d-f6c8-400e-8af0-0c4aace8f7a1__grouplist_getgrent_new.txt


Thanks,

Alexander Richardson

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140408/01523678/attachment.html>


More information about the Kde-frameworks-devel mailing list