Commit Graph

136 Commits

Author SHA1 Message Date
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
wiz c81aaebd36 New sentence, new line. 2005-02-05 15:28:46 +00:00
wiz e6ef4830c4 Be consistent in -r argument naming. 2005-02-05 15:26:50 +00:00
jmmv bc6cd262e3 Add the -r flag to groupadd; it can be used to specify a gid range in which
new groups should be created.  This is similar to useradd's -r flag.

Closes my own PR bin/22791.  Patch by URA Hiroshi with some minor changes
by me.

No objections in tech-userlevel@ for multiple days.
2005-02-05 10:43:14 +00:00
agc b186672660 Now that we have SHA1 passwords, modify useradd(8) so that it will accept
an encrypted SHA1 password on the command line.
2004-07-02 12:01:00 +00:00
agc f8d5e607b8 Add -S argument to useradd, usermod and userdel, which allows the use of
a trailing '$' character in user names.

Requested in PR 23922 by Takahiro Kambe.

Also, fix a bug in the previous fix to usermod.
2004-01-14 09:35:33 +00:00
agc e75d2f492c Fixes from Todd Miller in PR 24070.
Revert fgetln/asprintf changes from rev 1.26 - fgetln(3) does not return
a NUL-terminated string, so using strchr(3) is inappropriate. As the entry
from the password file is a known size, there's no need to use fgetln(3),
just use fgets(3) for consistency. This also means that an inappropriate
cast to int from asprintf(3) is unneeded, which was apparently causing
problems on OpenBSD's sparc64 port - just be consistent and use snprintf(3).
2004-01-14 08:25:30 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
agc 68f1651086 Tidy up the previous isdigit(3) boolean check. 2003-10-21 06:34:26 +00:00
fvdl 1cb8eb7415 Don't compare an int to NULL. 2003-10-21 02:58:50 +00:00
wiz dea83a9f43 Clarify that the user's full name (not username) goes into the GECOS field.
From Jeff Ross via jmc@openbsd.
2003-09-04 08:37:59 +00:00
agc 65feb98718 Some patches from Todd C. Miller:
1. Use REG_NEWLINE, rather than matching "\n".

2. Fix a bug where rm_user_from_groups would mangle group entries in
/etc/group when the user to be removed is the only member of the group,
by using substring matches.
2003-06-12 17:00:53 +00:00
agc 9878b0d124 The "default" case usually occurs at the end of all other options, so change
it to follow convention.

Add /* NOTREACHED */ comments, per share/misc/style.
2003-04-14 17:40:07 +00:00
dsl 238b338f74 Report usage() if getopt() returns '?'
Partial fix for bin/21146
2003-04-14 09:49:15 +00:00
jrf 151509e229 This addresses PR 20156. isalnum(), isdigit() and isspace() are used with
char as a parameter. On platforms with char signed by default, those are wrong.
Thanks to Christian Biere christianbiere@gmx.de for the patch he supplied.
I tested the patch and agc approved it for commit.
2003-03-14 16:56:39 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
grant 806593a806 The correct capitalisation of 'NetBSD.org' is (you
guessed it) 'NetBSD.org'.

some mdoc fixes.
2003-02-14 16:11:34 +00:00
perry 8a49ec08e4 "Utilize" has exactly the same meaning as "use," but it is more
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
2003-02-04 23:07:28 +00:00
agc 7cb1f145f5 Add a check for the length of the login name given by the user.
Provided by Ben Collver in PR 20154
2003-02-03 12:20:46 +00:00
jmmv 4c30a46c79 Fix typo in first form synopsis: -k does not require -r. Okay'ed by wiz. 2003-01-22 20:50:47 +00:00
wiz 7f3797c977 directory has a c. From Adrian Mrva. 2002-12-21 12:52:13 +00:00
agc d6b0aed068 When deleting a user with preservation, use a password of
"*************" rather than a single asterisk - it's just as difficult
to hash to the longer password since the asterisk character itself is
not in its alphabet, and pwd_mkdb now thinks it's a valid DES password.
2002-11-08 11:53:20 +00:00
agc 7843f87c3d Factor out some common code. 2002-11-08 11:44:37 +00:00
wiz 40a72a2371 Undo last, on request by agc. 2002-10-02 17:30:08 +00:00
wiz 4fcce79872 utilize American spelling. 2002-10-02 15:45:32 +00:00
grant 7d8ff25974 new sentence, new line. 2002-10-02 13:49:11 +00:00
itojun 7cf12fa457 valid_password_length() is a boolean function, so there's no point in
having "> 0" in if clause.
2002-10-01 02:50:51 +00:00
agc 92ef00aeba Update previous to reflect reality. For blowfish passwords, the salt
can be a variable length field, so check the (fixed length) password
length, rather then the length of the whole password+salt+cipher.

Use a cipher type of "$2a" for blowfish.
2002-09-30 14:15:47 +00:00
agc e7bdda1971 Handle PR 18474 in a more safe and scalable fashion - keep a table of
password types, and their associated lengths, and check in useradd or
usermod whether the given encrypted password has the correct length.

This removes the (duplicated) hardcoded lengths which had crept in
with the last commit, and also checks the length of the given password
against the expected length.
2002-09-30 10:32:40 +00:00
itojun 84237f231a support MD5/blowfish password. PR 18474. 2002-09-30 04:05:22 +00:00
agc 2f14b22182 Describe what this utility does a bit better. Pointed out by Curt Sampson. 2002-09-06 08:59:25 +00:00
agc 18e50dcd89 Use syslog(3) to log new users and groups, deletions of users and groups,
and modification of user and group information.

Syslog priority is LOG_INFO, facility is LOG_USER (there is no need to
do this via LOG_AUTH, since the password and group files are world
readable).

Suggested by Hubert Feyrer, after a similar facility in Linux.
2002-08-27 12:38:02 +00:00
agc 051f76f577 Generalise the function which checks if a user is local to work for groups
as well.

Use the new function when modifying a group's information.
2002-08-27 11:25:29 +00:00
wiz aea5088350 Set the default password (if not specified) to a single star instead
of PasswordLength stars.
2002-08-07 14:24:52 +00:00
agc b35288ab0c Add a function is_local_user(), and use it in moduser(), to check that
the user is not found through NIS.

Completes fix of PR 17849, from Grant Beattie (grant@netbsd.org).

Also, don't cast return type of pw_abort(3) to void, as it already is void.
2002-08-06 11:56:26 +00:00
agc 569d79bd84 Remove the /etc/ptmp file via pw_abort(3) if the pw_mkdb(3) call fails.
Addresses part of PR 17849 from Grant Beattie, grant@netbsd.org.
2002-08-06 09:03:55 +00:00
grant eda9e509bb sweep of errx/warnx, remove unnecessary trailing \n 2002-07-20 08:40:16 +00:00
wiz 7c42d2fdaf Clean up last (no spaces before parentheses). 2002-07-09 14:13:18 +00:00
tron 4a3185f506 Get rid of __P() here. The rest of the sources doesn't use it, too. 2002-07-09 10:34:44 +00:00
tron cb35c09756 Fix build problem probably caused by some toolchain change. 2002-07-09 10:34:16 +00:00
agc c24c69434f Remove user from supplementary groups when deleting a user and not
preserving information.

Remove BUGS section from userdel(8) accordingly.

Make this utility compile with WARNS=3 - add const-poisoning and
shadow variable name resolution.
2002-07-08 22:17:47 +00:00
wiz 2e935ec638 Don't xref ourselves, use Nm. 2002-06-24 18:22:37 +00:00
wiz d4144f2137 Drop trailing whitespace and sort sections. 2002-06-24 18:20:54 +00:00
grant 551a65be7c add BUGS section (1 entry from bin/11244) 2002-06-24 17:28:07 +00:00
grant 091e72dbd4 be more explicit about creation of /etc/usermgmt.conf 2002-06-10 08:33:05 +00:00
grant ef33e31e46 mention that -D creates defaults file if it doesn't already exist and if
we are running as root.
2002-06-10 07:53:48 +00:00
wiz aa912aee09 Sort SEE ALSO. 2002-06-01 09:21:21 +00:00
wiz eb6d65caac Widen tag for list. 2002-06-01 09:21:11 +00:00
grant 9210200e15 add usermgmt.conf man page.
user -e and -f now accepts "month day year" (ala chpass(1)) and
seconds-since-epoch.
correct man pages accordingly.
2002-06-01 06:28:06 +00:00