If the 'rm -rf' works, then the home directory does not exist any more,
and rmdir() on it will return an error (ENOENT). Catch and ignore it.
Avoids:
# useradd -m foo
# userdel -r foo
userdel: Unable to remove all files in `/home/foo': No such file or directory
advantages of our ksh (emacs line editing). There were objections against
using ksh, because our (pd)ksh is not the real ksh. See also the
discussion on tech-userlevel.
Motivation for changing the default from csh is better interactive
usability and desire to use a standard shell, which is already used for
all the system shell scripts.
Approved by core.
to be a null-terminated string. Otherwise, if the user is not a member
of any secondary groups, buf is completely uninitialized and userinfo
adds garbage to the list of groups printed.
will allocate memory and assign it to its first argument, so it is neutral
Coverity CID 3229: memory leak -- failed to fclose() master in moduser()
Coverity CID 3228: memory leak -- failed to free() newname in groupmod()
file.
Modify the logic in the previous but one commit - /sbin/nologin should
be considered a valid user shell, since otherwise, with the addition
of the checks for a valid user shell, useradd with a shell of
/sbin/nologin will fail.
Modify some of the code here to conform to the standards in the rest
of this file.
- Fix error messages, some are completely incorrect
- Asystem prints the error message so don't bother saving errno
- Don't continue if a lock can't be obtained on /etc/group
- Just pass struct passwd * to removehomedir, not its members
Some copyright maintenance:
- Add Liam Foy.
- Move Todd's copyright higher up.
XXX: We should remove clause 3 and merge the two copyright groups.
- Correct lenght for the username
- First character in the login name cannot be '-' (OpenBSD)
- Remove some #ifdef EXTENSIONS. find_group_info is always needed
- When printing change, if it's -1, place a correct string.
*tp > LONG_MAX is never true, so replace that check with a test
for strtol() setting errno == ERANGE (oddly, some ports' build
swallowed this without warning).
There's no guarantee that a time_t stores the same number of bits
as a long, so check for an overflow there as well, and pass any
error up.
Discussed with christos, martin and mrg.