Commit Graph

15669 Commits

Author SHA1 Message Date
brueffer
2dc82f9774 Fix a few mandoc warnings.
MFC after:	1 week
2015-08-12 10:34:05 +00:00
mav
a4e4af47b0 Another small typo.
MFC after:	3 days
2015-08-11 09:00:27 +00:00
mav
f292c98681 Fix minor typo.
MFC after:	3 days
2015-08-11 08:58:00 +00:00
araujo
d07c9e53e5 style(9) requires a space here. 2015-08-11 01:45:17 +00:00
araujo
69588e0782 Sync the code with OpenBSD.
Remove 3rd BSD clause.

Differential Revision:	D3289
Approved by:		bapt (mentor)
Obtained from:		OpenBSD
2015-08-11 01:33:36 +00:00
bz
8c2e5e5995 Rather than hardcoding a string and limiting the comparison to these
characters use the defined constant so that in case of change this
would not break.

Reviewed by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D3340
MFC after:		2 weeks
2015-08-10 10:29:32 +00:00
ed
208fb6e96d Remove bad call to shutdown().
The socket created by rtsol/rtsold is not a connection-based socket,
meaning that we should not attempt to call shutdown() on it.

Reported by:	kan
2015-08-10 07:45:13 +00:00
mav
35adb2b287 Refactor early stages of security negotiation.
MFC after:	2 weeks
2015-08-08 19:04:37 +00:00
mav
2039dd9ad4 Remove some code duplication.
MFC after:	1 week
2015-08-08 16:39:28 +00:00
brueffer
94936bfa1d Manpage cleanup.
- new sentence -> new line
- fix manpage references
- fix macro usage
- fix a typo

MFC after:	1 week
2015-08-07 10:48:52 +00:00
bapt
f8f56ae6ef Add regression tests for a bug reported in stable/10
While pw(8) on head is not affected it is worth adding more regression tests
ensuring this bug will not happen unnoticed in the futur
2015-08-05 21:11:32 +00:00
ngie
15c1eedd90 Set f_file to -1/F_UNUSED when after closing when possible
This will help ensure we don't trash file descriptors that get used later on
in the daemon

Found via internal Coverity scan

MFC after: 2 weeks
Discussed with: cem, ed, markj
Differential Revision: https://reviews.freebsd.org/D3081
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2015-08-05 03:17:06 +00:00
svnmir
c5e8194f33 Ensure the local MANIFEST is always used when verifying remote
distribution sets.

MFC after:	immediately
Sponsored by:	The FreeBSD Foundation
2015-08-04 13:40:26 +00:00
ed
08ce46330f Avoid calling strlen() where we can use the strspn() return value. 2015-08-03 22:07:50 +00:00
dteske
ce892f6643 Clarify pw(8) manual w/respect to required arguments. Break long lines at
punctuation while here.

Differential Revision:	https://reviews.freebsd.org/D2700
Reviewed by:	wblock, bapt
MFC after:	3 days
X-MFC-to:	stable/10
2015-08-03 21:19:31 +00:00
bapt
eb6ff5c8b3 Fix bugs spotted by gcc
Reported by:	adrian
2015-08-03 06:06:56 +00:00
adrian
a01e37a027 Actually set quiet to something.
/usr/home/adrian/work/freebsd/head-embedded-2/src/usr.sbin/pw/pw_user.c: In function 'pw_user_next':
/usr/home/adrian/work/freebsd/head-embedded-2/src/usr.sbin/pw/pw_user.c:680: warning: statement with no effect
2015-08-03 05:59:30 +00:00
bapt
9a7989cc8d Use intmax_t rather than long long 2015-08-02 19:49:24 +00:00
bapt
e969e86e40 Convert the year used for regression test fro 2043 to 2037
This makes the regression tests pass on systems where time_t is 32bits
2015-08-02 18:20:36 +00:00
bapt
069c5cd075 Fix build on 32bits 2015-08-02 13:50:11 +00:00
bapt
2c026ebb5c Split some extra long lines 2015-08-02 13:33:17 +00:00
bapt
2cfaa818a1 Split some extra long lines 2015-08-02 13:32:23 +00:00
bapt
4469579834 Cleanup a bit includes 2015-08-02 13:22:46 +00:00
bapt
8ca0483df0 Add regression tests about adding already existsing groups/users 2015-08-02 13:02:53 +00:00
bapt
4453f16adb Fix regression: report if a group already exists when creating it 2015-08-02 12:56:25 +00:00
bapt
521095bbe7 Fix regression: report again if a username already exists when creating it 2015-08-02 12:54:15 +00:00
bapt
1890bfce80 Remove dead code 2015-08-02 12:48:36 +00:00
bapt
4f6bdcfb5d Rewrite parsing subcommands arguments of pw(8)
Now each subcommands checks its arguments in a dedicated functions.

This helps improving input validation, code readability/maintainability
While here:
- Add a -y option to pw userdel/usermod so it can maintain NIS servers if
  nispasswd is not defined in pw.conf(5)
- Allow pw -r <rootdir> to remove directory with userdel -r
- Fix bug when renaming a user which was not renaming the user name it groups
  it is a member of.
- Only parse pw.conf(5) when needed.
2015-08-02 12:47:50 +00:00
bapt
f78f701a2d Remove netbsd tests on pw(8)
First they are redundant with the tests we currently have on pw(8)
Second they to modify the host database instead of being self contained withing
the test directory
2015-08-02 00:33:34 +00:00
bapt
e83b0ae9f0 Remove things that crept in after badly checked revert 2015-08-01 12:20:55 +00:00
bapt
8fa8b523a2 Partial revert of r286152
More work needed on the cli validation
2015-08-01 12:18:48 +00:00
bapt
353f021396 Fix build 2015-08-01 11:52:48 +00:00
bapt
626fd041e6 Fix formatting of new code
Fix sorting or errstr
Remove useless initialisation or errstr

Reported by:	bde
2015-08-01 11:31:59 +00:00
bapt
dff11a9b7f Revert r286148 2015-08-01 10:40:17 +00:00
bapt
9a71628c9f Validate expiration days and password days from commmand line and pw.conf 2015-08-01 10:25:55 +00:00
bapt
10ba8e17a1 Validate the max_uid/max_gid boundaries and entry type in pw.conf 2015-08-01 10:10:13 +00:00
bapt
5acf1473e1 Cast uid/git to uintmax_t when using printf-like functions so the size of
uid/gid size remains a implementation detail
2015-08-01 09:55:47 +00:00
bapt
ae91558e00 Handle +:*:: the same way we handle +::: when checking group file
The first is what the documentation recommands for NIS client
2015-08-01 08:39:55 +00:00
bapt
32471dd33a Use strtoumax instead of strtoul 2015-08-01 08:35:20 +00:00
bapt
1567d1bb44 Improve strtounum
Fix many style bugs
Better variable naming
Use C99 'restrict' were apropriate
Fix potential errno race

Submitted by:	bde
2015-07-30 06:14:47 +00:00
bapt
d7ee5ad52d Cleanup includes 2015-07-29 23:26:18 +00:00
bapt
b34a90165d Actually set the proper license
Reported by:	trasz
2015-07-29 22:51:54 +00:00
bapt
dc24acf353 Actually add the new code 2015-07-29 06:23:06 +00:00
bapt
4eb9f59af4 Create a strtounum function using the same API as strtonum
This function returns uintmax_t
Use this function to convert to gid_t/uid_t
2015-07-29 06:22:41 +00:00
bapt
5d01982f6b Reject usermod and userdel if the user concerned is not on the user database
supposed to be manipulated

This prevent pw usermod creating a new local user when requesting to usermod on
a username is defined in LDAP.

This issue only happens when modifying the local user database (not inpacting
commands when -V or -R are used).

PR:		187653
Submitted by:	tmwalaszek@gmail.com
2015-07-28 21:49:38 +00:00
bdrewery
36fb21bb92 Fix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7).
This was causing the following error:

  rescue
  sh: rescue: not found
  *** [rescue] Error code 127

  make[1]: stopped in /usr/obj/usr/src/rescue/rescue

Sponsored by:	EMC / Isilon Storage Division
2015-07-28 21:39:58 +00:00
bapt
ae6e75a036 Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX
PR:		173977
Reported by:	nvass@gmx.com
2015-07-28 21:10:58 +00:00
bapt
39f3813b41 Fix wrong warning printed after changing or updating NIS users
PR:		37672
Submitted by:	chris+freebsd@chrullrich.de
2015-07-28 20:52:10 +00:00
bapt
6a2604d875 when -n is passed to any pw subcommand it is always expected to be considered as
a name so do not try to convert it to an id if it is a numeric value

PR:		31933
Reported by:	ted@impulse.net
Sponsored by:	gandi.net
2015-07-28 12:20:57 +00:00
araujo
fafebceb9b Staticfy and constify some variables and clean up the code a bit to make it
more readable. No functional change.

Differential Revision:	D3166
Reviewed by:		kib
Sponsored by:		gandi.net
2015-07-28 02:32:40 +00:00