Commit Graph

59 Commits

Author SHA1 Message Date
wiz 1d1f43e05c Improve handling of -l with -m, and update documentation.
Based on an idea by Alistair Crooks in bin/11707.
2000-12-23 17:19:48 +00:00
wiz a73ca31ff8 Clarify what happens if -d is specified without -m.
Fixes second part of bin/11707.
2000-12-23 16:30:21 +00:00
wiz 39df6581fe Fix moving a user's home directory with 'useradd -md /new/home/dir user'.
Clarify code (newpwp was referencing the same struct as pwp).
Fixes first part of bin/11707.
2000-12-23 16:29:35 +00:00
wiz 89d963e947 Don't try to create or move directory if only '-d' is given (man page
says '-m' is needed for that). Problem reported by Johnny C. Lam.
2000-12-07 17:44:03 +00:00
simonb 3854f3f705 Fix behaviour of 'useradd -m': it is now a fatal error if the target home
directory already exists.  Previously new skel files from /etc/skel were
copied and permissions/ownerships changed even if the directory already
existed.
2000-11-04 04:31:43 +00:00
simonb a2358fe791 Remove some debugging cruft in the removal of user home directories
accidently left in from revision 1.25.
2000-11-01 22:35:30 +00:00
simonb dc598d2a0c Run a "chmod -R u+w <newhomedir>" after copying files from skeldir.
Noted by Hubert Feyrer in private mail.
2000-11-01 22:29:10 +00:00
simonb 2ad83f6dcf Don't let usage messages wrap around on an 80 column terminal.
Problem noted by Hubert Feyrer in private mail.
2000-11-01 22:18:22 +00:00
assar e89ad55da9 cast pw_change (a time_t) into long and printf it as %ld 2000-10-18 01:45:12 +00:00
simonb 6dfb84a930 For userinfo - if a password change or expiry time_t is 0, print "NEVER"
instead of some date around Jan 1, 1970.
2000-10-17 05:43:10 +00:00
simonb 5114e81f10 Handle -G for the useradd case (usermod was already correct). Also
show warning if a non-existant group is specified.

Patch from PR bin/11123 by David Edmondson.
2000-10-17 05:31:50 +00:00
simonb 051741ede8 Document the skel-dir and shell default settings.
Clean up skeleton dir list.

Part of fix for PR bin/10985.
2000-10-17 04:54:43 +00:00
simonb 97c54a1bab Use flags to set which parts of a passwd entry are to be changed.
Before removing the home directory of a user check that
  + the user does not have uid 0
  + the user is the owner of the directory.
and remove the files using the effective user-id of the user.  Show
a warning if the directory is not removed.

Use asprintf and fgetln for some string work to remove arbitary string
length limitations.

Fixes for PRs bin/11100 and bin/11103.
2000-10-17 04:53:27 +00:00
simonb 20fa427df4 Remove unneeded skel files.
Part of fix for PR bin/10985.
2000-10-16 13:46:48 +00:00
is d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
bjh21 adf3f4b907 Fix SYNOPSES:
Options without arguments go first in a bunch (see /usr/share/misc/style)
"add", "del", "info", "mod" arguments to user(8) and group(8) are command
modifiers, not normal text.
-D is not optional when setting the defaults for useradd(8)

Also add a missing .Ar to groupinfo.8
2000-10-03 19:32:23 +00:00
bjh21 08964241f9 The usual formatting fixups. 2000-10-03 12:47:13 +00:00
bjh21 7faddc8d05 Only one fix here -- use .Ar when referring to arguments in running text. 2000-10-03 12:38:05 +00:00
bjh21 867a62d338 Apply .Fl, .Dq, .Ql and .Ar where necessary to fix formatting. 2000-10-03 12:34:05 +00:00
bjh21 41ed24d174 Fix the blank line in my last commit.
.Fl-ify mentions of "-D"
Use .Dq rather than ""
2000-10-03 12:18:09 +00:00
bjh21 b56ee45833 General prettification.
There's a glitch in the display describing the "group" option in
usermgmt.conf.  I can't get rid of the blank line above it without it
losing the line break after the colon as well.  Anyone?
2000-10-02 18:28:28 +00:00
simonb 956cbe59dd Don't refer to the skel-directory files here. 2000-10-01 09:18:59 +00:00
simonb 7ebee5683d Save the "preserve" value in the defaults file.
Use _PATH_CSHELL from <paths.h> instead of the string "/bin/csh".
Don't cast NULL to the pointer type being checked.
2000-10-01 08:56:28 +00:00
simonb 9014a6cdcd Fix typo. 2000-10-01 08:54:07 +00:00
agc 9da93f35c8 Add functionality for adding usernames to secondary groups via the
"usermod -G group user" command.

Fixes PR/11071.
2000-09-29 10:37:26 +00:00
agc 4361ae7cb0 Correct a pasto in moduser(), the effect of which was to replace the
contents of the GECOS comment field with the default shell name, when
a user's information was modified.
Fixes PR 11072.
2000-09-26 11:35:48 +00:00
agc 61daa070a6 If we're about to add a user whose specified home directory does
not exist, and the "-m" argument has not been specified, then output
a warning.
2000-09-20 19:28:40 +00:00
wiz 4d73d17ffe user's UID is not kept if preserve is "false" (typo fix)
false(1) -> .Xr false 1
2000-08-18 15:49:21 +00:00
agc 468671f5be Pick up the changes that make sense from OpenBSD
+ Use _PATH_GROUP and _PATH_MASTERPASSWD (from OpenBSD)
+ Use -G group1,group2,group3 for multiple groups in useradd and usermod
(pointed out by Matt Green, and also changed in OpenBSD, but done more
efficiently here)
+ is_number should not be inside #ifdef EXTENSIONS (from OpenBSD)
+ clear up yet another usage message (for user(8) and group(8)) - noticed
in passing, unknown if fixed anywhere else
2000-05-16 20:23:28 +00:00
agc 5290363261 Revert previous change, since maintenance across -current, pkgsrc and the
1.4 branch requires one set of sources.
2000-05-09 09:25:21 +00:00
hubertf 02820d32d6 Remove code for 1.4 backward compatibility (to be put into the package,
where it really belongs)
2000-05-05 01:27:47 +00:00
simonb fd4ede242b Don't declare 'extern opt*' getopt variables. 2000-04-14 06:26:52 +00:00
soren 2ef4fd2cdb Consistently move checkeuid() call to after usage() call to allow non-root
to get help. Also remove a few duplicate geteuid() calls.
2000-03-31 04:09:04 +00:00
soren 4d9f35a323 Remove a few unnecessary casts. 2000-03-31 03:11:24 +00:00
soren ae994d44aa Use char NULs. 2000-03-31 02:54:17 +00:00
soren 89c5a767f8 Fix doubled 'the's. 2000-03-13 22:55:05 +00:00
jlam d1246a821e Make "-d homedir" option work -- home directory wasn't being set in this
case.
2000-03-12 19:57:24 +00:00
agc 56d283540f When adding a group, check that it doesn't already exist.
Also fix a problem with reading entries when modifying a group.

Both problems found and analysed by Thomas Klausner.
2000-03-07 20:56:45 +00:00
enami b0a2a63928 - Use .Ar for argument.
- Move SEE ALSO section before the HISTORY section as described in
  mdoc(7) with:
	+ removing traing dot.
	+ spliting files into FILES section.
- Refer pathnames using .Pa (rather .Ar or .Xr).
2000-02-28 05:10:56 +00:00
agc 199e667b0f Add RCS Id and Copyright. 2000-02-02 15:12:10 +00:00
agc 2f3f04acfd Enhancements from Hubert Feyrer:
+ copy all files and directories in <skeldir> to new user's home
directory, not just if they begin with a '.'
+ use pax to copy files from <skeldir>, as this will allow <skeldir>
to contain directory trees as well as regular files
+ use -h arg to chown(1) in case any symlinks have been created in the
new user's home directory
+ getpwnam(3) does not set errno, so use errx(3) and warnx(3)
+ use nologin(8) in preference to false(1) when deleting users but
preserving information
+ in usage messages, specify [-r lowuid..highuid] rather than a simple
[-r range]
1999-12-31 21:58:14 +00:00
agc 7497747c60 Add new functionality, and fix some bugs and oversights:
+ Moved all internal definitions from usermgmt.h to user.c
+ Added prototypes to usermgmt.h
+ Allow defaults to be set at build time
+ Check the effective uid is 0 if any data is to be modified
+ Check all numeric uids and gids really are numeric
+ Fix a bug (reported by lenb at sasquatch.com) where new ranges were
appended to old ranges, rather than replacing them
+ Add userinfo(8) and groupinfo(8) utilities (if EXTENSIONS is
defined), whereby user and group information can be displayed.  Add
manual pages for new utilities.  Add front-end calling from user(8)
and group(8) accordingly.
+ Make all functions visible outside the user.c file again.  User and
group manipulation may be split out into a separate shared lib in the
future
+ Split off main function into a separate main.c
+ Changed default group to be "users"
+ Changed despatch table for commands to work in a more sane manner
+ Added "default-group" target to Makefile, so that the default group
can be made easily.
1999-12-24 09:08:48 +00:00
hubertf 93331a6d49 Remove code to make this compile on 1.4.1, as requested by Luke and
Frank. We'll need to move this to pkgsrc to get it for 1.4.1.
1999-12-13 00:26:26 +00:00
lukem 8c1445f5dc * cleanup the usage messages:
- put `usage' at the start of each message
	- put a space between the option and arg in [-x foo]
* fix command parsing for when a two word command is invoked without
  args or with an invalid second arg so that a more appropriate error
  message is printed.
1999-12-08 21:45:54 +00:00
hubertf 73332d1d4c Make MKDIR just be /bin/mkdir, without -p 1999-12-08 18:22:54 +00:00
hubertf f925a43bdf - Only use strlcpy() on systems that have it, i.e. >=1.4K. This makes
this working again on 1.4 systems.
 - Revert last change to argument passing which broke "user del",
   "user mod", ...
1999-12-08 18:12:16 +00:00
soren 6cc6a03447 Add adduser(8) for compatibility. 1999-12-08 00:01:36 +00:00
lukem bbd13d34a8 * don't dump core if run without args
* use strlcpy() instead of homegrown strnncpy()
* sort #includes
1999-12-07 10:42:12 +00:00
lukem 02bc52bd3e remove unused STRNCPY macro 1999-12-07 10:37:57 +00:00
lukem dda92ed7f3 missing , 1999-12-07 10:25:33 +00:00