Commit Graph

85 Commits

Author SHA1 Message Date
agc 0a602aa3de Handle multiple ranges on the command line and in the defaults file,
based on some code from Todd C.  Miller, which in turn was based on a
patch from Brian Poole <raj@cerias.purdue.edu>.

Look first in any uid ranges specified on the command line, in the order
they were given on the command line, and then in any ranges specified in
the defaults file.

With thanks to Brian for nudging me a number of times to fix this.
2002-05-03 10:31:14 +00:00
agc 2de2bc02d6 Fix for skeleton directory changes to defaults file from Brian Poole
<raj@cerias.purdue.edu>

Previous behaviour as follows:

# useradd -D -k /foo/bar
group           users
base_dir        /home
skel_dir        /foo/bar
shell           /bin/csh
class
inactive        0
expire          Null (unset)
range           10200..10300
range           10600..10700
# useradd -D
group           users
base_dir        /home
skel_dir        /etc/skel
shell           /bin/csh
class
inactive        0
expire          Null (unset)
range           10200..10300
range           10600..10700
2002-05-03 10:11:16 +00:00
agc 3db3295859 Fix from Brian Poole <raj@cerias.purdue.edu> for improper handling of
UID ranges. Previous behaviour is demonstrated below...

# useradd -D
group           users
base_dir        /home
skel_dir        /etc/skel
shell           /bin/csh
class
inactive        0
expire          Null (unset)
range           10200..10300
# useradd -D -r 10200..10300 -r 10400..10500
# useradd -D
group           users
base_dir        /home
skel_dir        /etc/skel
shell           /bin/csh
class
inactive        0
expire          Null (unset)
range           10400..10500

The second command should have put 2 ranges back into the config file,
but it really only put one because the first range on the command line
was marked as a duplicate (but when it got to writing the config file,
it only wrote command line ranges, so the 10200 got skipped).  Fix
this by initializing defrc to 0 and then only looking after defrc for
duplicate ranges.
2002-05-03 10:05:28 +00:00
agc 00ee66cd54 Modifications from Brian Poole <raj@cerias.purdue.edu>, via OpenBSD:
+ if the cd built-in fails, don't try to copy the directory hierarchy
  with pax - s/;/&&/ in a shell command
+ clean up after ourselves if a rename fails - remove the newly-created
  group file.
2002-05-03 08:07:02 +00:00
agc 3387a6a54e Do the previous differently. Run through the possible ranges for uids in
the command line order, then check the default range after that, if none
has yet been found.

Prompted by Brian Poole <raj@cerias.purdue.edu>.
2002-03-31 21:31:10 +00:00
mason 3b5b0345cc Make wording and intent clearer. "Real-world" users have expressed confusion,
and the former wording didn't help.
2002-02-27 17:42:41 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
agc bf3822aec1 Search uid ranges properly, using command line ranges if provided, and
using the default range last.

Problem reported by Cillian Sharkey <cns@redbrick.dcu.ie>
2002-02-05 19:18:29 +00:00
wiz 32344167c3 Sort SEE ALSO, use standard headers. 2002-02-02 02:07:01 +00:00
wiz 23455e9072 Use standard headers. 2002-02-02 02:06:50 +00:00
wiz 97e18ab0bb Fix typo in date, sort SEE ALSO, use standard headers. 2002-02-02 02:06:23 +00:00
wiz b75432a4bf Use standard headers. 2002-02-02 02:05:29 +00:00
wiz a2d753e3ef Whitespace nits. 2002-01-19 11:44:57 +00:00
agc cd27040c88 + add backwards compatibility hook for old pw_mkdb() calls with no args
+ remove some unused code in a comment.

+ add F_SHELL flag in userdel

+ use a separate local declaration for a temporary variable, rather
than overloading a variable that's used for something else.
2001-10-22 11:00:05 +00:00
agc c94b91a672 Update documentation to reflect reality - "userdel -p" replaces the login
shell with /sbin/nologin, rather than /usr/bin/false.
2001-10-16 08:17:07 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
hubertf 5653bfc431 if creategid() fails, don't try to print system error message (use errx()
instead of err()), as all error cases in creategid() are already commented
properly from inside creategid().

This prevents funny errors like:

	miyu# groupadd test2
	miyu# groupadd test2
	groupadd: group `test2' already exists
	groupadd: can't add group: problems with /etc/group file: Inappropriate ioctl for device
2001-09-16 18:08:37 +00:00
christos 9a9926ee57 PR/13874: Hubert Feyrer: Add -L class to useradd 2001-09-05 21:37:32 +00:00
ad 1e8e78ed07 Update for pw_mkdb() change: restrict updates to one user's records and/or
the secure database where appropriate.
2001-08-18 19:35:32 +00:00
joda 3a2248a4e7 (usermod): ~F_MKDIR is usually much better than !F_MKDIR in bit masks 2001-08-17 08:29:00 +00:00
itojun 85856f18c0 do not make "useradd foo -s bar" to ignore "-s bar" silently. require
exactly one username.
2001-06-23 02:42:32 +00:00
wiz 5b6ad2d2f5 Drop argument of .Os. 2001-06-05 11:31:21 +00:00
agc 248b28d16b Size the columns in the table of related files better.
Be a bit more precise about the location of example files.
2001-04-27 09:13:35 +00:00
agc 542fb8cd9a Mention that pwd_mkdb(8) is used to update the database, and that it may
take some time to complete at large sites, as in vipw(8).

Cross-reference pwd_mkdb(8)
2001-02-21 12:16:07 +00:00
cgd 25bdbb661e convert to use getprogname() 2001-02-19 23:22:40 +00:00
lukem e379b8ae5f groupmod: ensure that the modified group has the trailing newline 2001-02-13 21:27:03 +00:00
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