Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use getgrouplist() instead of getgrnam() #4611

Closed
michaelrsweet opened this issue Mar 23, 2015 · 3 comments
Closed

Use getgrouplist() instead of getgrnam() #4611

michaelrsweet opened this issue Mar 23, 2015 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@michaelrsweet
Copy link
Collaborator

Version: 2.2-feature
CUPS.org User: twaugh.redhat

I've had a report that using getgrnam() can be unreliable:
https://bugzilla.redhat.com/show_bug.cgi?id=1204379

and that the more common case of count(groups user is in) < count(users in group) would be speeded up by the use of getgrouplist().

A patch is available at the original bug report. What do you think about this general approach?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Will consider, and need to make sure this is portable. But more promising than some of the other proposed fixes for this over the years...

@michaelrsweet michaelrsweet added the enhancement New feature or request label Mar 17, 2016
@michaelrsweet michaelrsweet added this to the 2.2 milestone Mar 17, 2016
@urusha
Copy link

urusha commented Apr 28, 2016

We use CUPS with winbind (for determining group membership of domain users). Since samba 4.2 "winbind enumerate groups" parameter is 0 by default. So "getent group somegroup" doesn't return any members. This makes CUPS AllowUser with "@" statements work only with primary groups of users.
As I see in scheduler/auth.c CUPS (2.1.3) loops through members of group instead of just looping through current user's group list (getgrouplist.3) which is much faster I suppose, especially when comparing to groups containing hundreds of users.
In smb.conf(5) this behavior is called "broken applications". I think it's true for this case, at least when talking about performance.
Also, I have to say that many distributions have updated samba major versions (e.g. 4.1-> 4.3) after bad lock vulnerability - so this issue could affect many current installations of CUPS+winbind. smb.conf workaround is trivial, but I think this change should be included to the next release.
Thanks for attention.

@michaelrsweet
Copy link
Collaborator Author

[master 6eb98ae] The scheduler now uses the getgrouplist function when available (Issue #4611)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants