Bug 318121 - libuser doesn't indicate an error if it couldn't create a new user's home directory
Summary: libuser doesn't indicate an error if it couldn't create a new user's home dir...
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libuser   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 646388
TreeView+ depends on / blocked
 
Reported: 2007-10-04 12:09 UTC by Nils Philippsen
Modified: 2010-10-25 09:45 UTC (History)
1 user (show)

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 04:16:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Nils Philippsen 2007-10-04 12:09:52 UTC
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 04:16:29 UTC
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 07:26:01 UTC
Don't mind about the home directory checking, system-config-users does that now
by itself.

Comment 3 Nils Philippsen 2007-10-11 09:29:03 UTC
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.