Commit Graph

184 Commits

Author SHA1 Message Date
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
wiz 771b656bd0 Add missing .El. From Nicolas Joly in PR 32546. 2006-01-20 21:50:54 +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
wiz b141897d50 Punctuation fixes. 2005-11-16 20:24:17 +00:00
christos 77bea244d5 user portion of the EXTENSIONS documentation. From Liam Foy. 2005-11-16 18:44:37 +00:00
wiz c6257ebac1 Mark up EXTENSIONS. 2005-11-09 23:50:16 +00:00
wiz 36470a753d Drop trailing whitespace. 2005-11-09 23:48:51 +00:00
christos df29ab0769 Mention which options are only available with EXTENSIONS. From Liam Foy. 2005-11-07 23:07:45 +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 edd2c20bae Comment out /usr/share/examples/usermgmt -- dir does not exist. Fix macro typo.
From YOMURA Masanori in private mail.
2005-09-11 23:49:20 +00:00
wiz ba3a0dadf1 Sync group* usages with man pages. 2005-09-09 22:04:09 +00:00
wiz ac4e0a8127 Reformulate slightly to match other man pages. Use standard
EXIT STATUS section. Bump date.
2005-09-09 22:02:12 +00:00
wiz a2bc89c87d Do not list all options for group* -- they are bound to get out of sync here.
Use standard EXIT STATUS section. Bump date.
2005-09-09 22:01:20 +00:00
wiz f629e1e94e Sync user* usage with man pages. Bonus grammar fix in comment. 2005-09-09 21:48:10 +00:00
wiz 31e0e03316 Improve -p description in second case. 2005-09-09 21:43:42 +00:00
wiz d0260f31e6 Reformulate slightly to match other man pages. 2005-09-09 21:31:25 +00:00
wiz 32587324af Use standard EXIT STATUS section.
Reformulate slightly to match other man pages. Bump date.
2005-09-09 21:31:00 +00:00
wiz d48b71a0a8 Sort options and option descriptions. Use standard EXIT STATUS section.
Reformulate slightly to match other man pages. Bump date.
2005-09-09 21:30:31 +00:00
wiz a431cb6155 Reformulate slightly to match other man pages. 2005-09-09 21:29:08 +00:00
wiz 42fd4ae9cd Do not list all options for user* -- they are bound
to get out of sync (as they currently are, for example). Use standard EXIT STATUS
section. End sentences with dots. Bump date.
2005-09-09 21:26:09 +00:00
wiz e545853576 Sort option descriptions. 2005-09-09 20:48:16 +00:00
wiz 3a653a2ba9 Sort options and descriptions. Add standard EXIT STATUS section. Bump date. 2005-09-09 20:46:49 +00:00
hubertf 105b456cb7 Mention pwhash(1) in a few places,
suggested in PR 31125 by Stefan Schumacher.
2005-09-05 03:37:14 +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 c509b6a960 Fix reverse description of expiry/inactive. From Liam J. Foy. 2005-08-08 21:53:17 +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
christos 32a16509f3 If the class was not specified, don't print a warning. 2005-07-30 14:35:23 +00:00
christos 42ec3173f1 Don't make it fatal if the login class doe not exist. From Jukka Salmi. 2005-07-29 18:16:21 +00:00
wiz 54fa7b8a6b Various improvements. 2005-07-28 20:23:31 +00:00
peter cea4f4ef79 Minor tweaks to the usage message:
- better layout for useradd.
- fix a small mistake in -u and wrap long line.
2005-07-27 23:32:02 +00:00
christos 9f01a2d031 Patches from Liam Foy:
- Add new -C option to 'usermod'. This allows a quick way to temporary
  lock a users account. This is similar to how FreeBSD do it using
  'adduser'. This function can be very handy to administrators!
- Import a function to check if the inputted class actually exists. It
  contains my modifications to test whether /etc/login.conf exists
  in the first place. -OpenBSD
2005-07-27 19:09:21 +00:00
christos 24e9d708ff Patches from Liam Foy:
- Add new -C option to 'usermod'. This allows a quick way to temporary
  lock a users account. This is similar to how FreeBSD do it using
  'adduser'. This function can be very handy to administrators!
- Import a function to check if the inputted class actually exists. It
  contains my modifications to test whether /etc/login.conf exists
  in the first place. -OpenBSD

While I am there:

- KNF (long wrapped lines, and spaces after void casts).
- Factor out some common code.
- Fix error messages.
	1. Consistently capitalize them.
	2. Fix err->errx and warn->warnx inappropriate uses.
	3. Use regerror where appropriate.
	4. Don't call warn()/err() to report errors after you trashed errno
	   by calling other syscalls. Save and restore the errno instead,
	   or in the warn() case, call warn() first.
- Fix size_t - int, uid_t - int confusion.
- Pass lint
2005-07-27 19:08:42 +00:00
agc c426bea6d7 Commit changes from Liam J. Foy:
- system(), rmdir() sets errno, use it
- Use warnx() if strchr failed, not warn()
- Constify some arguments
- Fix cases when errx()/warnx() should be used instead of err()/warn()
  due to errno not being set.

Group code:
------------
- List members in a neat fashion, separated by commas
- groupmod(): Use find_group_info - consistency
2005-07-20 21:42:58 +00:00
agc 6fdfc9ef36 Be consistent when deleting a non-existent group - tell if the group is
non-existent.

Problem noted by Geert Hendrickx, fix from Liam J. Foy.
2005-06-14 18:29:58 +00:00
agc 8313edf555 Do some Common Subexpression Elimination when testing for valid characters
in login and group names.
2005-04-05 22:54:26 +00:00
peter 943430a954 Allow '_', '.' and '-' in group names, like in login names.
Fixes problem with groupadd(8) for _pflogd; pointed out by Jukka Salmi.

Approved by christos.
2005-04-05 22:03:57 +00:00