[Pkg-shadow-devel] groupmems: invalid usernames handling && segfault fix

Nicolas François nicolas.francois at centraliens.net
Wed Jul 30 14:22:06 UTC 2008


On Wed, Jul 30, 2008 at 02:54:12PM +0200, lkukline at redhat.com wrote:
> Saturday 26 of July 2008 18:33:24 Nicolas François wrote:
> > This is committed now.
> 
> I was looking at this recently and it is "fixed" differently now. 
> Unfortunately checking if user to be added to group exists breaks everything 
> else (at least on my machine). Problem is on the end of process_flags 
> function (from svn), at this line:
> 
> if (getpwnam (adduser) == NULL) {
> 
> When user doesn't want to add user to a group (i.e. doesn't specify  -a 
> option), adduser variable is NULL and getpwnam() segfaults. And this 
> definitely does not make groupmems utility more usable ;).
> 
> it should be like "if (adduser && getpwnam (adduser) == NULL)" or so.

Thanks. It's fixed.

> (maybe it would be nice if getpwnam() handeled NULL by returning NULL)
> 
> > By the way, as you already had a look at groupmems, I'm wondering what is
> > the intent of isgroup()?
> 
> I have no clue, but I see it is removed already.

Yes, I removed it after some cleanup, but I can re-introduce it if anybody
find how it should be used.


I will add a checklist for groupmems, which should detect these issues,
but as it is not installed on Debian, I will have to tweek it a little
bit.

Kind Regards,
-- 
Nekral



More information about the Pkg-shadow-devel mailing list