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

Lukas Kuklinek lkukline at redhat.com
Wed Jul 30 12:54:12 UTC 2008


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.
(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.

> I'm going to apply the attached patch to completely remove it (unless
> somebody finds the original intent of isgroup().
>
> Best Regards,

Lukáš Kuklínek



More information about the Pkg-shadow-devel mailing list