Patch for adduser: Create a system user
Denys Vlasenko
vda.linux at googlemail.com
Mon Oct 29 19:36:28 UTC 2007
On Wednesday 24 October 2007 21:45, Tito wrote:
> On Wednesday 24 October 2007 22:41:48 Ralf Friedl wrote:
> > Tito wrote:
> > > maybe this could fix the problem you report:
> > > ...
> > > /* create new gid always = uid and re-check if the uid is free */
> > > while (getgrgid(p->pw_uid) && getpwuid(p->pw_uid))
> > > p->pw_uid++;
> > >
> > I think this shoud use "or", not "and":
> >
> > while (getgrgid(p->pw_uid) || getpwuid(p->pw_uid))
> > p->pw_uid++;
>
> Ops.... :-(
>
> > Personally, I don't use this feature, it was only an observation that it
> > might be possible to create duplicate ids if this feature is used.
>
> Ok, then let's see what Denis thinks about it...
Thanks guys for this discussion. I used this patch for simplifuing adduser.
Please take a look on current svn's adduser.c. Hmm. I'm attach it too.
It also has "can select duplicate uid" bug fixed too:
/* check for a free uid (and maybe gid) */
while (getpwuid(p->pw_uid) || (!p->pw_gid && getgrgid(p->pw_uid)))
p->pw_uid++;
BTW, why are we setting setgid bit here?
chmod(pw.pw_dir, 02755) /* set setgid bit on homedir */
I vaguely remember that it means something for the creation of new files.
Right? I'd like to update the comment.
Tito, Ralf, thanks again!
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adduser.c
Type: text/x-csrc
Size: 4229 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071029/40012978/attachment-0002.c
More information about the busybox
mailing list