Commit Graph

15772 Commits

Author SHA1 Message Date
Alexander Motin
2f444d157b Drop "internal" CTL frontend.
Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places..
2015-08-15 13:34:38 +00:00
Baptiste Daroussin
5770ce6f1d Regression: fix pw usermod -w xxx
Reported by:	gjb
2015-08-14 13:39:55 +00:00
Christian Brueffer
99d43aee11 Fix a few mandoc warnings.
MFC after:	1 week
2015-08-12 10:34:05 +00:00
Alexander Motin
a7ab146375 Another small typo.
MFC after:	3 days
2015-08-11 09:00:27 +00:00
Alexander Motin
97e14c64da Fix minor typo.
MFC after:	3 days
2015-08-11 08:58:00 +00:00
Marcelo Araujo
006bf8a619 style(9) requires a space here. 2015-08-11 01:45:17 +00:00
Marcelo Araujo
e5763f0069 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
Bjoern A. Zeeb
f2dedc73e0 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 Schouten
a1b862daec 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
Alexander Motin
d7f5186022 Refactor early stages of security negotiation.
MFC after:	2 weeks
2015-08-08 19:04:37 +00:00
Alexander Motin
4462a6049d Remove some code duplication.
MFC after:	1 week
2015-08-08 16:39:28 +00:00
Christian Brueffer
84fe889c63 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
Baptiste Daroussin
f5a15df7d8 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
Enji Cooper
c1987c2852 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
Glen Barber
1da17fb7be 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 Schouten
fc6ab77011 Avoid calling strlen() where we can use the strspn() return value. 2015-08-03 22:07:50 +00:00
Devin Teske
1e4d5cf1d6 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
Baptiste Daroussin
5e52b667a7 Fix bugs spotted by gcc
Reported by:	adrian
2015-08-03 06:06:56 +00:00
Adrian Chadd
bbec1b5a7b 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
Baptiste Daroussin
5cc12db1c7 Use intmax_t rather than long long 2015-08-02 19:49:24 +00:00
Baptiste Daroussin
9e24273cca 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
Baptiste Daroussin
fc5079452d Fix build on 32bits 2015-08-02 13:50:11 +00:00
Baptiste Daroussin
8159e0373f Split some extra long lines 2015-08-02 13:33:17 +00:00
Baptiste Daroussin
9261982d92 Split some extra long lines 2015-08-02 13:32:23 +00:00
Baptiste Daroussin
bcbdb01e56 Cleanup a bit includes 2015-08-02 13:22:46 +00:00
Baptiste Daroussin
b8a5086ef0 Add regression tests about adding already existsing groups/users 2015-08-02 13:02:53 +00:00
Baptiste Daroussin
f4124312a1 Fix regression: report if a group already exists when creating it 2015-08-02 12:56:25 +00:00
Baptiste Daroussin
a64b90fbaa Fix regression: report again if a username already exists when creating it 2015-08-02 12:54:15 +00:00
Baptiste Daroussin
db533440b7 Remove dead code 2015-08-02 12:48:36 +00:00
Baptiste Daroussin
d2d022b9fd 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
Baptiste Daroussin
0996b15464 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
Baptiste Daroussin
458fdd97ab Remove things that crept in after badly checked revert 2015-08-01 12:20:55 +00:00
Baptiste Daroussin
7493058fb6 Partial revert of r286152
More work needed on the cli validation
2015-08-01 12:18:48 +00:00
Baptiste Daroussin
7391bf5ada Fix build 2015-08-01 11:52:48 +00:00
Baptiste Daroussin
510113b84d 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
Baptiste Daroussin
f2164ae0fa Revert r286148 2015-08-01 10:40:17 +00:00
Baptiste Daroussin
80d9f89289 Validate expiration days and password days from commmand line and pw.conf 2015-08-01 10:25:55 +00:00
Baptiste Daroussin
e5e7ef48eb Validate the max_uid/max_gid boundaries and entry type in pw.conf 2015-08-01 10:10:13 +00:00
Baptiste Daroussin
50698e6718 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
Baptiste Daroussin
f4e060d0f7 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
Baptiste Daroussin
e622418c5b Use strtoumax instead of strtoul 2015-08-01 08:35:20 +00:00
Baptiste Daroussin
a86e343db6 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
Baptiste Daroussin
796ba6fcc2 Cleanup includes 2015-07-29 23:26:14 +00:00
Baptiste Daroussin
c308ef6fd2 Actually set the proper license
Reported by:	trasz
2015-07-29 22:51:54 +00:00
Baptiste Daroussin
22665b2563 Actually add the new code 2015-07-29 06:23:06 +00:00
Baptiste Daroussin
8411215a80 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
Baptiste Daroussin
bbdee3ebde 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
Bryan Drewery
b99a71b1da 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
Baptiste Daroussin
90a4edb584 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
Baptiste Daroussin
81e2ba845c 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