Bug 318121 - libuser doesn't indicate an error if it couldn't create a new user's home directory
libuser doesn't indicate an error if it couldn't create a new user's home dir...
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: libuser (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Miloslav Trmač
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 646388
  Show dependency treegraph
 
Reported: 2007-10-04 08:09 EDT by Nils Philippsen
Modified: 2010-10-25 05:45 EDT (History)
1 user (show)

See Also:
Fixed In Version: 0.56.5-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 646388 (view as bug list)
Environment:
Last Closed: 2007-10-11 00:16:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nils Philippsen 2007-10-04 08:09:52 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):

libuser-0.56.4-3

How reproducible:

Easy

Steps to Reproduce:
1. run this small python program:

--- 8< --- createuser.py ---
#!/usr/bin/python

import libuser

a = libuser.ADMIN ()
u = a.initUser('foo')
u.set (libuser.HOMEDIRECTORY, "an illegal home directory")
print "adduser:", a.addUser (u)
--- >8 ---
  
Actual results:

root@wombat:/home/nils/test/python> ./createuser.py 
adduser: 1
root@wombat:/home/nils/test/python> echo ~foo
an illegal home directory

Expected results:

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).
Comment 1 Miloslav Trmač 2007-10-11 00:16:29 EDT
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.
Comment 2 Nils Philippsen 2007-10-11 03:26:01 EDT
Don't mind about the home directory checking, system-config-users does that now
by itself.
Comment 3 Nils Philippsen 2007-10-11 05:29:03 EDT
NB: "home directory checking": checking for the validity of the specified path

Note You need to log in before you can comment on or make changes to this bug.