Baptiste Daroussin
d14c48479c
Make a separate groupdel/userdel from the main function
2015-07-11 19:07:47 +00:00
Baptiste Daroussin
ae73dd9f37
Make separate functions to show users and groups
2015-07-11 18:09:27 +00:00
Baptiste Daroussin
8daa3a67ff
Move the quiet flag into the configuration structure
2015-07-11 17:01:08 +00:00
Baptiste Daroussin
f936ccb5f8
Separate usernext/groupnext from the main functions
2015-07-11 16:58:47 +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
391ad8ceb8
Remove dead code
2015-07-05 10:14:34 +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
1f8d909274
Fix validation of crypted password
...
Small cleanups
2015-07-04 15:56:59 +00:00
Baptiste Daroussin
9d028e08ce
Also validate inputs of pw groupmod -h and groupmod -H
2015-07-04 15:54:11 +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
4369c82dc6
Change the documentation to reflect where the -V option should be used
...
Suggested by: kientzle
2015-06-14 21:50:38 +00:00
Simon J. Gerraty
ccfb965433
Add META_MODE support.
...
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.
Still need to add real targets under targets/ to build packages.
Differential Revision: D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704
dirdeps.mk now sets DEP_RELDIR
2015-06-08 23:35:17 +00:00
Baptiste Daroussin
3bfc59e83b
backout remove of -q option for pw [user|group] next
...
While the return code is broken, some corner case usage depends on the
functionnality, so backout until we get better regression tests covering those
corner case usage.
2015-06-08 05:27:34 +00:00
Baptiste Daroussin
6328a4be57
Fix typo
2015-06-08 05:06:17 +00:00
Baptiste Daroussin
a57d4bf3a1
Fix mistakes than came along with r284139
2015-06-07 21:59:43 +00:00
Baptiste Daroussin
0958dffde2
Remove '-q' support for pw [user|group] next
...
the intent of -q in this command is to return as exit status the value of the
next group/user id, which does not make sense given exit status are limited to
values between 0 and 255.
2015-06-07 21:57:20 +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
91860967e2
Fix duplicate checking
2015-06-07 19:59:01 +00:00
Baptiste Daroussin
c40bbdb4af
Remove uneeded code (already done by pw_make_v7)
2015-06-07 19:39: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
Baptiste Daroussin
3438d7decf
Finish converting -7 to pwconf
2015-06-07 15:54:57 +00:00
Baptiste Daroussin
c86f7ad56d
Handle -7 via gloval pwconf
2015-06-07 15:33:08 +00:00
Baptiste Daroussin
bbe09b2e19
Initialize conf using menset(3)
2015-06-07 15:29:58 +00:00
Baptiste Daroussin
2166b4d190
Handle pretty print (-P) via global pwconf
2015-06-07 15:27:17 +00:00
Baptiste Daroussin
363cefdbb1
Handle dryrun (-N) via global pwconf
2015-06-07 15:09:53 +00:00
Baptiste Daroussin
be7f5ba991
Sort headers
2015-06-07 14:57:16 +00:00
Baptiste Daroussin
82a3c75aa8
Handle -C and -Y locally and stop adding them to arglist
2015-06-07 14:54:07 +00:00
Baptiste Daroussin
2cc63cd136
Add a new global struct pwconf to store etcpath, rootdir and struct userconf
...
Do not add anymore -R and -V to arglist
Add an error message if both -V and -R are set in arguments
2015-06-07 14:34:38 +00:00
Baptiste Daroussin
fe084e12a5
Fix pw userdel -r not deleting homedir
2015-06-07 14:32:52 +00:00
Baptiste Daroussin
a68be5f7eb
Test explicitly the result of strcmp to be consistent with the rest of the code
2015-06-07 11:38:26 +00:00
Baptiste Daroussin
fc606d2b2c
Improve readability by reducing indentations levels
2015-06-07 11:35:34 +00:00
Baptiste Daroussin
75a030d4f8
Remove one level of indentation
2015-06-07 11:30:33 +00:00
Baptiste Daroussin
581a66ea58
Move user deletion code into a separate function to improve readability
2015-06-07 11:26:28 +00:00
Baptiste Daroussin
1238a919d2
Instead of always casting the pw_checkname input to u_char * and casting it back
...
to char *, change pw_checkname to directly take char * in input
2015-06-07 10:57:02 +00:00
Glen Barber
a5b912ff43
Document pw(8) '-R' option, added in r283961.
...
MFC after: 1 week
X-MFC-after: r283961
Sponsored by: The FreeBSD Foundation
2015-06-03 19:17:45 +00:00
Baptiste Daroussin
ac72be285f
New pw -R rootdir option
...
This allows to set an alternate root directory in which the users/groups will be
manipulated
Requested by: gjb, ian
Tested by: gjb
2015-06-03 19:08:25 +00:00
Baptiste Daroussin
6138e089bc
Cast to gid_t for groups not uid_t
2015-05-31 22:12:31 +00:00
Baptiste Daroussin
68cea7d570
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
Baptiste Daroussin
ee2582c212
Cast -1 to uid_t and bump WARNING level to 3
2015-05-31 21:44:09 +00:00
Baptiste Daroussin
7fc593dd82
Move cleanup functions to the right place
2015-05-31 12:04:06 +00:00
Baptiste Daroussin
2e6d97a407
Remove useless test before free()
2015-05-31 11:56:59 +00:00
Baptiste Daroussin
c69b42d00b
Return early in case we cannot read the configuration file
...
This drops one level of indentation
2015-05-31 11:55:28 +00:00
Baptiste Daroussin
5710dc534c
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
Baptiste Daroussin
850f836ad8
Remove uneeded intermediate variable
2015-05-31 10:18:10 +00:00
Baptiste Daroussin
e55af20b47
Remove uneeded intermediate variable
2015-05-31 10:14:13 +00:00