Re: (forw) Bug#294345: passwd: useradd does not create homedirs with "-" in the path
Tomasz Kłoczko <[email protected]> Thu, 10 Feb 2005 01:06:47 +0100 (CET)
| Newsgroups | gmane.linux.pld.shadow.general |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 10 Feb 2005, Tomasz KÂłoczko wrote:
[..]
>> postamt:/home/t# /usr/sbin/useradd -m -d /home/x/-/testruebe testruebe
[..]
> So correct useradd commamd line parameters for above is:
>
> # useradd -m -d -- /home/x/-/testruebe testruebe
Wait .. stop .. back .. this is COMPLETLY incorrect answer :->
This not command line parameters parsing related :>
This is real bug in src/useradd.c in create_home() function. All above is
because /home/x does not exist and not because path part is "-"
character :)
# strace -e trace=mkdir useradd -m -d /home/x/a/testruebe testruebe
mkdir("/home/x/a/testruebe", 0) = -1 ENOENT (No such file or directory)
useradd: cannot create directory /home/x/a/testruebe
>From mkdir(2):
ERRORS
[..]
ENOENT A directory component in pathname does not exist or is
a dangling symbolic link.
Simple on mkdir() must be added resursive checking and create parent
directoty if it does not exist.
[shadow]$ grep mkdir */*c -l
libmisc/copydir.c
src/newusers.c
src/useradd.c
src/usermod.c
Probably newusers and usermod also is affected by the same bug. So this
second thing for solve for shadow 4.0.8 (first is audit and cleanup all
exports declarationsin *.c files :)
Thanks for report bug.
kloczek
--
-----------------------------------------------------------
*Ludzie nie majÂą problemĂłw, tylko sobie sami je stwarzajÂą*
-----------------------------------------------------------
Tomasz KÂłoczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*