Red Hat Bugzilla – Bug 318121
libuser doesn't indicate an error if it couldn't create a new user's home directory
Last modified: 2010-10-25 05:45:06 EDT
Description of problem:
When creating a new user, libuser doesn't indicate if it couldn't create the
home directory (e.g. with an illegal home directory path, or disk is full/has
run out of inodes/...).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. run this small python program:
--- 8< --- createuser.py ---
a = libuser.ADMIN ()
u = a.initUser('foo')
u.set (libuser.HOMEDIRECTORY, "an illegal home directory")
print "adduser:", a.addUser (u)
--- >8 ---
root@wombat:/home/nils/test/python> echo ~foo
an illegal home directory
libuser should return 0/False on the addUser() call and somehow indicate what
went wrong so the UI can tell the user what exactly went wrong (it could
alternatively be e.g. that it couldn't create the mail store).
Thanks for your report.
Error reporting in libuser-0.56.5-1 should be better (in particular, if a home
directory can't be created, addUser doesn't try to create a mail spool and
return 1 if the mail spool could be created).
The example is not clearly incorrect - "an illegal home directory" is a valid
relative path, after all, and libuser doesn't do much consistence checking. I
have modified the functions to create and move home directories to reject
relative paths (so addUser fails after creating the account but before creating
the home directory) - but creating an user account with a nonsensical home
directory without creating the directory itself is still allowed.
Don't mind about the home directory checking, system-config-users does that now
NB: "home directory checking": checking for the validity of the specified path