[Adduser-devel] Bug#336843: adduser: removes user from group if
/etc/group file ends with ":"
Marc Haber
mh+debian-packages at zugschlus.de
Thu Nov 3 20:11:15 UTC 2005
reassign #336843 perl
retitle #336843 getgrnam returns trailing ":" in user name
thanks
On Tue, Nov 01, 2005 at 05:43:40PM +0100, Marc Haber wrote:
> If a line in /etc/group ends with a colon, adduser user group removes
> the last user listed in /etc/group:
>
> $ cat /etc/group | grep ^adm
> adm:x:4:Debian-console-log,mh:
> $ sudo adduser --debug Debian-exim adm
> Adding user Debian-exim' to group adm'...
> Done.
> $ cat /etc/group | grep ^adm
> adm:x:4:Debian-console-log,Debian-exim
> $
>
> Setting $verbose=2 prior to the systemcall() in the adduser code
> reveals that adduser calls
> /usr/bin/gpasswd -M Debian-console-log,Debian-exim adm
> so it is really adduser's fault that mh vanishes from the user list.
Actually, it's perl's fault:
$ grep '^wheel' /etc/group
wheel:x:104:mh,scyadmin
$ perl -e 'foreach (split(/ /,
(getgrnam("wheel"))[3])) { print "$_\n"; };'
mh
scyadmin
$ grep '^wheel' /etc/group
wheel:x:104:mh,scyadmin:
$ perl -e 'foreach (split(/ /,
(getgrnam("wheel"))[3])) { print "$_\n"; };'
mh
scyadmin:
[12/511]mh at scyw00225:~$
Judged that ":" is the field separator in /etc/group, and that
/etc/group might change its format to include more fields, and that a
colon is not a valid character in a user name (it would wreck havoc in
/etc/passwd), I would expect that perl would consider the ":" a
delimiter here and not return it as part of the group name.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
More information about the Adduser-devel
mailing list