Commit Graph

135 Commits

Author SHA1 Message Date
nia 8bb8291bb8 Fix copypasto in comment. 2021-12-12 14:33:13 +00:00
nia d855902010 useradd(8): Recognize Argon2 passwords as "valid" when they are given
on the command line.

Reported by Robert Nestor on current-users@.
2021-12-10 20:06:29 +00:00
wiz 3afef2ec6e Fix warning in userdel -r.
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
2019-07-29 09:33:21 +00:00
zafer 061f0fcc8a Set default homeperm values before writing usermgmt.conf file and honor values in it instead of ignoring it.
Fixes PR bin/40324 by Guy Yur
2018-06-10 07:52:05 +00:00
blymn 9a57dec753 Fix error message when trying to add a group using -g =uid that
that already exists, the old version printed the wrong GID.
2012-11-28 11:31:27 +00:00
blymn 2da0bfd2ff Google Code In bug fix by Philip Hayes, fixes bin/41049 2012-11-28 11:20:58 +00:00
dholland 4cd06b238c Move path names to pathnames.h per conventions 2011-12-01 00:34:05 +00:00
dholland 5cea11a8b9 Handle return value from system() properly.
PR 45672 from River Tarnell.
2011-12-01 00:26:45 +00:00
dholland 334ade83c1 attribute format printf -> __printflike 2011-12-01 00:15:32 +00:00
wiz e57ebdb6c5 Close masterfd after reading from it. Found by cppcheck. 2011-01-04 10:30:21 +00:00
mlelstv 6ee63fe8b0 Add new keyword gid_range to usermgmt.conf which specifies a default
GID range for groupadd(8).
2009-12-31 19:59:31 +00:00
hubertf 2058a998c8 Fix -p:
* rm_eo is the first character *after* the match, so no need for a +1
 * Blowfish hashes are only 53 chars long, not 54
2009-10-15 23:03:02 +00:00
mike c7f073e0ff Fix check for duplicate gid when '-g =uid' is specified to usermod.
Closes PR bin/40391
2009-03-20 02:53:47 +00:00
mike 0779b10efc Do not allow duplicate group id in groupmod unless -o is specified.
Closes PR bin/40393
2009-03-18 04:59:45 +00:00
christos 7022cb2a8d bin/40994: Michael van Elst: usermod -l change password so user is unable to
login. User getpwnam_r to avoid trashing result of previous call to getpwnam().
2009-03-11 14:18:03 +00:00
lukem 9c1945664c Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 13:36:57 +00:00
reed a87ec1e425 Remove the -v verbose switch from userinfo. It was not used.
Also remove reference to usermgmt.conf from userinfo manpage.

Discussed on tech-userlevel.
2008-02-27 19:12:56 +00:00
hubertf f81f738d09 disclaim copyright 2008-02-04 01:28:20 +00:00
pavel e98941caa4 Change the default shell to /bin/sh. It has most of the usability
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.
2006-11-02 21:42:08 +00:00
wiz b7a8d82a23 Sort options in usage. 2006-10-13 20:43:31 +00:00
elad 5e188d0b70 PR/30351: Hubert Feyrer: useradd(8) doesn't allow setting permissions of
new home [patch]

Adapted to current code and some nits from myself. Thanks for the patch!
2006-10-07 09:20:07 +00:00
pavel 338033d1c7 revert change of default shell, reguested by agc@. 2006-09-30 11:47:00 +00:00
pavel 4d8dbf3bf0 Change the default shell to /bin/ksh, which is our best interactive
shell at the moment. Proposed on tech-userlevel and approved by hubertf@.
2006-09-30 10:50:32 +00:00
pavel 3b850c18c8 in userinfo, initialize buf (the buffer which will hold group names)
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.
2006-09-30 10:44:55 +00:00
christos 5efc77fb1e use realloc instead of free+calloc 2006-06-27 12:39:23 +00:00
jnemeth b7899a65bc try again with the Coverity annotation 2006-06-02 21:44:37 +00:00
jnemeth d9a7dcfba5 Coverity annotation -- although memsave free()s its first argument, it
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()
2006-05-27 03:41:48 +00:00
joerg 368cb1b951 Garbage collect cc in moduser, it is only set once, but never read as
noticed by lint.
2006-03-22 18:02:46 +00:00
joerg 5dc48904d3 Don't leak FILEs when flock fails. Found by Coverity (CID 1776, 1777 and
1778). Patch by Liam J. Foy, which handles one more case.
2006-03-22 18:01:11 +00:00
dmcmahill de309be996 put the array bounds check _before_ accessing the array.
Coverity  CID: 1479
2006-03-17 14:20:10 +00:00
dmcmahill ee00225705 put the array bounds check _before_ accessing the array.
Coverity  CID: 1480
2006-03-17 14:14:45 +00:00
christos aa3a9e822d By popular demand don't bail out if a user's shell is not in /etc/shells.
Issue a warning instead.
2006-02-23 22:45:25 +00:00
jmmv 1cd43a0b52 Add a missing space in the usage message. 2006-01-26 17:24:52 +00:00
agc 9823410edb Use a CPP definition for "/sbin/nologin" - it's at the top of the
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.
2006-01-14 22:00:52 +00:00
elad 87a445663d Add forgotten ')'. 2006-01-13 16:36:33 +00:00
christos efe8347be7 treat /sbin/nologin specially. 2006-01-13 13:43:23 +00:00
christos ca0029edd3 Add checks for valid shell. From Liam Foy. 2006-01-06 18:11:00 +00:00
agc 40a712f2d4 Be pragmatic - move user(8) to a 3-clause BSD licence. 2005-11-25 08:00:18 +00:00
christos 6b3d6b9d93 remove asprintf and strlcpy. We don't support NetBSD1.3 and NetBSD1.4.
GC Todd's copyright, since it is not needed anymore.
2005-11-07 21:58:12 +00:00
christos 9b674959c3 More cleanups from Liam Foy:
- 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.
2005-11-07 21:46:50 +00:00
christos c81227bb08 call pw_abort() on failure (from Liam Foy) 2005-10-05 21:17:53 +00:00
rpaulo ece51eabd5 PR 22469: user.c should use "pwd.h" include file for
_PATH_USERMGMT_CONF. By rpixley@vm-netbsd-161.nominum.com.
2005-09-19 00:43:17 +00:00
agc c73a10fe94 Ensure that a consistent coding style is used.
s/1/EXIT_FAILURE/
2005-09-18 21:41:26 +00:00
christos 4471e7c6f5 From Liam Foy:
- 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.
2005-09-18 14:15:53 +00:00
christos c9d876ed6c Warn if the group being removed is still the primary group of an existing
user. From Liam Foy.
2005-09-12 15:45:03 +00:00
wiz ba3a0dadf1 Sync group* usages with man pages. 2005-09-09 22:04:09 +00:00
wiz f629e1e94e Sync user* usage with man pages. Bonus grammar fix in comment. 2005-09-09 21:48:10 +00:00
he 1bb5735b5e Check the return value from mktime() and pass any error up.
*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.
2005-08-12 21:40:35 +00:00
christos 91b1a8d112 patch from Liam Foy to add a -F option to force a user to change her's/his
password at the next login.
2005-08-12 16:22:05 +00:00
christos 78a36d519b The language lawyers claim that it is invalid to test a freed pointer, so
don't!
2005-07-30 15:06:43 +00:00