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/testruebeFrom 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]

