Commit Graph

328 Commits

Author SHA1 Message Date
Baptiste Daroussin
a70fbf7ef5 Really fix -o 2015-07-13 09:12:05 +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
d7747c3c6f Regression fix: allow to create users with uid0
Reported by:	Jan Mikkelsen <janm@transactionware.com>
2015-07-13 09:08:27 +00:00
Baptiste Daroussin
a46045bbfa Fix logic of check duplicates that has been inverted 2015-07-13 09:07:38 +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
8a2ace2a78 Make getarg return NULL if args is NULL 2015-07-12 00:02:43 +00:00
Baptiste Daroussin
52f92d8c1d Fix regression: ensure when try to create the group and the user with the same
id if possible and nothing in particular was specified
2015-07-11 23:56:55 +00:00
Baptiste Daroussin
9c56d9c5e4 Remove now unused variable 2015-07-11 23:17:13 +00:00
Baptiste Daroussin
10e6a51cf3 Replace custom string array with stringlist(3) 2015-07-11 23:07:17 +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
8970fe5251 Remove unused argument from pm_passwd 2015-07-11 21:12:28 +00:00
Baptiste Daroussin
49c195e61e check the gecos format early: at the moment the -c option is parsed 2015-07-11 21:09:50 +00:00
Baptiste Daroussin
81e683d636 Remove useless use of goto 2015-07-11 20:18:34 +00:00
Baptiste Daroussin
04c25b678f Isolate pw lock/unlock into a separate function 2015-07-11 20:10:12 +00:00
Baptiste Daroussin
9dd1a593d2 homedir can only be populate during useradd 2015-07-11 19:14:09 +00:00
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