Re: useradd segfaults

Tomasz Kłoczko <[email protected]> Fri, 25 Feb 2005 08:11:49 +0100 (CET)
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
On Fri, 25 Feb 2005, John Newbigin wrote:

> I have reported this problem before and I really would like it resolved. 
> There is a static buffer used by shadow groups which is easily overrun if too 
> many users are added into the same group.
>
> The problem is the buffer size defined in /lib/gshadow.c line 51
> #define       MAXMEM  1024
>
> Gets filled.  As a workaround I increase the buffer size but this should be 
> fixed.

IIRC 1024 it is maximum group entry size for NIS/NIS+.
So icrease buffer size without checking is modified group settngs will 
be used in NISed system will probably break group database.

On first phase fix this defitely must be added exiting with proper error 
message/exit code instead segfaulting.

Next phases of full fix this need IMO some deeper thinking.
<shooting>
It can be correcly fixed in case when shadow tools will use modularised 
backend module loaded depending on which database type (files, db, NIS, 
LDAP etc.) program operate. Without this all what is probably possible is 
only kind of workaroud (?).
</shooting>

> See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=125510
>
> I have coded a patch which does dynamic allocation but the existing code 
> seems a bit funny so a rewrite is possibly required.  I am willing to do this 
> if someone wants to check it for me.

Please do this. I'll check this.

kloczek
-- 
-----------------------------------------------------------
*Ludzie nie majÂą problemĂłw, tylko sobie sami je stwarzajÂą*
-----------------------------------------------------------
Tomasz KÂłoczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*