bapt
cde50605c3
Cast to gid_t for groups not uid_t
2015-05-31 22:12:31 +00:00
bapt
dc90f50e54
Remove useless cast in printf and printf-like functions:
...
use %u for uid_t and gid_t
2015-05-31 22:07:03 +00:00
bapt
85ff7a5346
Cast -1 to uid_t and bump WARNING level to 3
2015-05-31 21:44:09 +00:00
bapt
7b87a7e6ff
Move cleanup functions to the right place
2015-05-31 12:04:06 +00:00
bapt
5da06ca262
Remove useless test before free()
2015-05-31 11:56:59 +00:00
bapt
b65872777d
Return early in case we cannot read the configuration file
...
This drops one level of indentation
2015-05-31 11:55:28 +00:00
bapt
e2af9b7893
Make pw_user()/pw_group() more consitent about errors
...
Some of errors were returned to the main function, some others caused a direct
exit via err(3).
The main function is only interested in EXIT_SUCCESS, so in all other cases
replace warn(3) + return err by err(3)
2015-05-31 11:23:19 +00:00
bapt
dd2cfeb01c
Remove uneeded intermediate variable
2015-05-31 10:18:10 +00:00
bapt
72cc9d055f
Remove uneeded intermediate variable
2015-05-31 10:14:13 +00:00
bapt
23c55809b1
Use asprintf instead of malloc + snprintf and test the memory allocation
2015-05-31 10:02:01 +00:00
bapt
3a4c3ed84f
Remove dead declaration
...
PR: 195928
MFC after: 2 days
2015-05-29 10:07:20 +00:00
bapt
0659e9b5d2
Remove extendline definition
...
Remove now unused PWBUFSZ define
2015-05-10 11:24:16 +00:00
bapt
6097f34be5
Use calloc(3) instead of malloc(3) + memset(3)
...
While here check the return of calloc(3)
2015-05-10 11:18:01 +00:00
bapt
7b3f5d741e
The initial logic for allocating the new string was wrong, the conversion
...
to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
to allocate the new string.
2015-05-10 10:15:36 +00:00
bapt
091698a77d
Use strndup(3) instead of malloc(3) + memcpy(3)
...
Check the return of strndup
2015-05-10 10:02:09 +00:00
bapt
065d18b9ef
Remove useless call to extendarray
2015-05-10 09:33:15 +00:00
bapt
ebdc3de2ac
The pwdb function is only used once to check the database rename it
...
pwdb_check and simplify it accordingly
2015-05-10 09:23:03 +00:00
bapt
15b9b89c4b
if the check of the pw db fails return the failed value
2015-05-10 09:11:12 +00:00
bapt
cac4a2a5a5
Some style(9) fixes
2015-05-10 09:02:15 +00:00
bapt
8b6866b1a0
Replace sprintf(3) with snprintf(3)
2015-05-09 22:48:48 +00:00
bapt
0d7a61d5ba
Use snprintf(3) instead of sprintf(3)
...
Remove useless "else"
2015-05-09 22:43:44 +00:00
bapt
ee9e5523ab
Remove now unused LNBUFSZ buffer size
2015-05-09 22:08:30 +00:00
bapt
6fcebe0418
Return from the function as early as possible
...
This reduces the depth of the if statements and improves clarity of the code
2015-05-09 21:53:33 +00:00
bapt
f8a287817e
Remove some uneeded headers
2015-05-09 19:29:55 +00:00
bapt
defd9f5516
Remove unneeded headers
2015-05-09 19:22:33 +00:00
bapt
f0a46849ff
Replace malloc(3) + strcpy(3) + strcat(3) by asprintf(3)
2015-05-09 19:12:16 +00:00
bapt
332806b946
Use snprintf(3) instead of strcpy(3) + strncat(3)
2015-05-09 19:09:34 +00:00
bapt
33ff7a2e5e
Use sbuf(9) instead of homebrewed buffered string
2015-05-09 19:00:16 +00:00
brd
c7fee6c304
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
brd
5f3f4bfe49
Add tests for account and password expiration.
...
Approved by: will
2015-02-17 14:48:16 +00:00
brd
0dba15bee9
Really fix the pw_usernext tests.
...
PR: 197612
Approved by: will
2015-02-15 21:42:10 +00:00
brd
a446d16b44
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
brd
4b28934517
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
bapt
798d728a63
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
bapt
d39bfa5fd5
Allow negative numbers in -u and -g options
...
PR: 196514
MFC after: 1 week
2015-01-24 19:13:03 +00:00
brd
a9f7c229c6
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
brd
2220b51696
Restructure to make it easier to extend in the future
...
Reviewed by: will
Suggested by: ngie
2014-12-09 23:26:47 +00:00
brd
0534d4b8fc
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
brd
37438c711e
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
brd
eced0880b9
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
brd
57a84aae16
Convert to LIBADD.
...
Reviewed by: bapt
2014-11-24 21:49:01 +00:00
brd
d92ed3c4d8
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
brd
3a05a8b85c
Clean up some language
...
Reviewed by: will
2014-11-17 15:44:00 +00:00
brd
f50123356c
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
bapt
76d74e0d6c
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
ngie
d1d15c667e
Require root when running the pw_delete and pw_modify test programs (pw(8)
...
requires it)
2014-11-03 09:26:39 +00:00
ngie
75dd7696e6
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
bapt
ed7e3cf94c
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
bapt
6021153528
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
bapt
74a34200a6
Fix atf syntax
2014-10-28 15:33:15 +00:00