Baptiste Daroussin
bb1816daa4
Fix err pointer not initialized to NULL resulting
...
Reported by: "O. Hartmann" <ohartman@zedat.fu-berlin.de>
2015-08-21 14:28:14 +00:00
Baptiste Daroussin
80b3ba7a8d
Fix typo in regression test
2015-08-21 11:25:42 +00:00
Baptiste Daroussin
729d9b2caa
Fix /home symlink creation
...
Add regression test about it
2015-08-21 09:28:20 +00:00
Baptiste Daroussin
95c64defd7
Fix useradd regression:
...
Readd the function to create the parents home directory if it does not exists.
if it is only a directory at the top level of the hierarchy symlink it into /usr
as it used to be done before.
Reported by: kevlo, adrian
2015-08-21 07:09:53 +00:00
Baptiste Daroussin
5770ce6f1d
Regression: fix pw usermod -w xxx
...
Reported by: gjb
2015-08-14 13:39:55 +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
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
b8a5086ef0
Add regression tests about adding already existsing groups/users
2015-08-02 13:02:53 +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
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
87bf5e9212
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
Baptiste Daroussin
aa509e5e81
Add regression tests to ensure we keep allowing creating users with uid0
2015-07-13 09:09:09 +00:00
Baptiste Daroussin
28b2f1294f
Ensure skeldir is abolute path (relatively to the rootdir)
2015-07-12 22:08:58 +00:00
Baptiste Daroussin
ee8c5d1451
pw -R <rootdir> userdel can now cleanup installation
...
Rewrite rm_r to use *at function, allowing to remove home directories along with
users. only crontabs and at(1) installation are not removed
Relnotes: yes
2015-07-12 21:43:57 +00:00
Baptiste Daroussin
65730d9349
Rework the home directory creation and copy or the skel content to use *at
...
functions
This allows to simplify the code a bit for -R by not having to keep modifying
path and also prepare the code to improve support -R in userdel
While here, add regression tests for the functionality
2015-07-12 20:29:51 +00:00
Baptiste Daroussin
67eea76de0
Add minimum regression tests for pw -R
2015-07-12 09:42:10 +00:00
Baptiste Daroussin
5ebd525aab
Rework groupmod modification:
...
Use gr_add(3) when possible to avoid code duplication.
Use a simpler logic to delete members of a group
2015-07-11 22:35:07 +00:00
Baptiste Daroussin
0fc58d1446
Do not try to set password on group if the group is added as a consequence of
...
of creating a user (regression from r285136)
Reported by: Fabian Keil <fk@fabiankeil.de>
2015-07-09 14:14:44 +00:00
Baptiste Daroussin
59856c7d26
pw: fail if an invalid entry is found while parsing master.passwd and group
...
PR: 198554
Reported by: diaran <fbsd@centraltech.co.uk>
MFC after: 2 days
2015-07-07 21:05:20 +00:00
Baptiste Daroussin
f6eae381a5
Also validate hours via strptime_l(3)
...
Simplify the code, by only using one parser, ensure the dates (hours and dates)
are valid
2015-07-05 10:11:35 +00:00
Baptiste Daroussin
330e423084
Validate expiration dates
...
Use strptime_l(3) to validate the dates provided in input
2015-07-05 09:48:03 +00:00
Baptiste Daroussin
11621f9650
Validate input of pw usermod -h and pwusermod -H
...
Push the code that set the password into a separate function to improve
readability
Add regression tests about pw usermod -h and pw usermod -H
2015-07-04 15:27:04 +00:00
Baptiste Daroussin
1718a38ffd
Fix setting uid/gid min/max via pw
2015-06-07 20:59:59 +00:00
Baptiste Daroussin
a68fbadb63
Fix generating configuration file
2015-06-07 20:44:06 +00:00
Baptiste Daroussin
bae068d22e
In case of rename validate the length of the new name
...
Check early that the new name fits MAXLOGNAME and store it in pwconf
2015-06-07 19:33:25 +00:00
Baptiste Daroussin
a923718979
Refactor input validation
...
Mutualize code to validate inputs of both 'user' and 'group' command
Test that the input name fits into MAXLOGNAME
2015-06-07 19:03:41 +00:00
Brad Davis
2cf395883e
Fix a race condition by allowing up to 5 seconds of difference between the time stamps.
...
PR: 197861
Approved by: will
2015-02-24 22:22:06 +00:00
Brad Davis
258e07800c
Add tests for account and password expiration.
...
Approved by: will
2015-02-17 14:48:16 +00:00
Brad Davis
cec1a873d7
Really fix the pw_usernext tests.
...
PR: 197612
Approved by: will
2015-02-15 21:42:10 +00:00
Brad Davis
270d667cd2
Remove an extra curly bracket that was causing intermittent failures.
...
PR: 197612
Submitted by: Robert O'Niel <oneil.rs@gmail.com>
Approved by: will
2015-02-14 18:22:31 +00:00
Brad Davis
e9cc10049e
Add tests for `pw usernext'.
...
PR: 197120
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Approved by: will
2015-02-09 21:15:52 +00:00
Baptiste Daroussin
4b2b10bd25
Revert r277652
...
uid and gid are never and should never be negative. The pw(8) manpage clearly
states the -u and -g arguments are for uids/gids, hence using negative values is
abusing a bug in former versions of pw(8)
2015-01-26 16:50:42 +00:00
Baptiste Daroussin
70a89b8588
Allow negative numbers in -u and -g options
...
PR: 196514
MFC after: 1 week
2015-01-24 19:13:03 +00:00
Brad Davis
d03f0c5199
Add tests for pw -N
...
PR: 150449
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Approved by: will
2014-12-16 14:50:33 +00:00
Brad Davis
c3baf459e6
Restructure to make it easier to extend in the future
...
Reviewed by: will
Suggested by: ngie
2014-12-09 23:26:47 +00:00
Brad Davis
6e740aa64a
Add some tests for user modification. [1]
...
Fix a missing test in the Makefile from my previous commit.
PR: 195834 [1]
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Approved by: will
2014-12-09 22:11:56 +00:00
Brad Davis
bfce762f3f
Break out the tests into a file per command and clean up some long lines
...
Approved by: will
2014-12-09 21:43:03 +00:00
Brad Davis
2ffc3ce50a
Add more tests for pw(8) useradd.
...
PR: 195832
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Approved by: will
2014-12-09 20:36:07 +00:00
Brad Davis
ecc3c92f90
Replace the pw(1) calls with a variable, to make it easier to to change across all the tests as needed.
...
Reviewed by: will
2014-11-19 23:07:46 +00:00
Brad Davis
f3bcbf2399
Clean up some language
...
Reviewed by: will
2014-11-17 15:44:00 +00:00
Brad Davis
45ba9627e4
Add a test for locking and unlocking user accounts
...
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Reviewed by: will
2014-11-15 05:12:30 +00:00
Baptiste Daroussin
90edef4fe0
Fix wrong message when using pw -V with a non existent directory
...
Add a regression test about it
PR: 194971
Submitted by: Freddy DISSAUX <bugzilla@dsx.bsdsx.fr>
2014-11-12 22:27:53 +00:00
Enji Cooper
e5f33ae3e7
Require root when running the pw_delete and pw_modify test programs (pw(8)
...
requires it)
2014-11-03 09:26:39 +00:00
Enji Cooper
bf1e083e01
Integrate usr.sbin/useradd/t_useradd.sh from NetBSD into FreeBSD as pw_test
...
- Suffix useradd/userdel commands with pw
- Remove the atf_expect_fail for bin/39546
Phabric: D921
Reviewed by: brd
Sponsored by: EMC / Isilon Storage Division
2014-11-03 06:07:55 +00:00
Baptiste Daroussin
6e6c53f063
Fix renaming a group via the gr_copy function
...
Add a regression test to pw(8) because the bug was discovered via using:
pw groupmod
PR: 187189
Reported by: mcdouga9@egr.msu.edu
Tested by: mcdouga9@egr.msu.edu
Patch by: Marc de la Gueronniere
2014-10-28 16:27:29 +00:00
Baptiste Daroussin
0def1c7441
Ensure pw userdel -u <invalid> do not try to remove root
...
Check the uid passed is actually a number as early as possible
MFC after: 1 week
2014-10-28 15:46:22 +00:00
Baptiste Daroussin
3b640d6bfc
Fix atf syntax
2014-10-28 15:33:15 +00:00
Baptiste Daroussin
156ebc2878
Do not delete the group wheel when bad argument is passed to pw groupdel -g
...
Check that the -g argument is actually a number, if not report an error.
This argument is converted without checking with atoi(3) later so without this
check it converts any alpha entries into 0 meaning it deletes the group wheel
Add a regression test about it
PR: 90114
Reported by: bkoenig@cs.tu-berlin.de
MFC after: 1 week
2014-10-28 14:54:04 +00:00
Baptiste Daroussin
6697d7663b
Fix a regression in pw usermod -G list
...
The user was perperly adding the to different groups from "list" but was not
removed from the other groups it could have belong to.
While here add a regression test about this bug
PR: 185666
Reported by: sub.mesa@gmail.com
MFC after: 1 week
2014-10-28 14:19:17 +00:00