Commit Graph

321 Commits

Author SHA1 Message Date
bapt
2f9218d542 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
bapt
13da2b2c87 Remove now unused variable 2015-07-11 23:17:13 +00:00
bapt
be61586cab Replace custom string array with stringlist(3) 2015-07-11 23:07:17 +00:00
bapt
a2b16f4acb 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
bapt
e3326739a7 Remove unused argument from pm_passwd 2015-07-11 21:12:28 +00:00
bapt
394857c344 check the gecos format early: at the moment the -c option is parsed 2015-07-11 21:09:50 +00:00
bapt
1f1e46ef86 Remove useless use of goto 2015-07-11 20:18:34 +00:00
bapt
7267051897 Isolate pw lock/unlock into a separate function 2015-07-11 20:10:12 +00:00
bapt
120396cfc3 homedir can only be populate during useradd 2015-07-11 19:14:09 +00:00
bapt
4c8679fa34 Make a separate groupdel/userdel from the main function 2015-07-11 19:07:47 +00:00
bapt
0ee1498c18 Make separate functions to show users and groups 2015-07-11 18:09:27 +00:00
bapt
4567491257 Move the quiet flag into the configuration structure 2015-07-11 17:01:08 +00:00
bapt
032c1600ec Separate usernext/groupnext from the main functions 2015-07-11 16:58:47 +00:00
bapt
f97075fb60 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
bapt
267e0f6761 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
bapt
68ef3a03c5 Remove dead code 2015-07-05 10:14:34 +00:00
bapt
3023aa7e21 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
bapt
c4be172c20 Validate expiration dates
Use strptime_l(3) to validate the dates provided in input
2015-07-05 09:48:03 +00:00
bapt
db415bb5d6 Fix validation of crypted password
Small cleanups
2015-07-04 15:56:59 +00:00
bapt
f3cda7681e Also validate inputs of pw groupmod -h and groupmod -H 2015-07-04 15:54:11 +00:00
bapt
af8a9dfc9a 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
bapt
2a257e3a0f Change the documentation to reflect where the -V option should be used
Suggested by:	kientzle
2015-06-14 21:50:38 +00:00
sjg
008d7c831f 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
sjg
75a137820d dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
bapt
ec480fe320 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
bapt
6e327f9366 Fix typo 2015-06-08 05:06:17 +00:00
bapt
2bc43a746d Fix mistakes than came along with r284139 2015-06-07 21:59:43 +00:00
bapt
65b30fab70 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
bapt
b0235ac2ee Fix setting uid/gid min/max via pw 2015-06-07 20:59:59 +00:00
bapt
fc781f489d Fix generating configuration file 2015-06-07 20:44:06 +00:00
bapt
302d4b4363 Fix duplicate checking 2015-06-07 19:59:01 +00:00
bapt
c668897924 Remove uneeded code (already done by pw_make_v7) 2015-06-07 19:39:06 +00:00
bapt
4a60f5b2aa 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
bapt
3be2bba5d7 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
bapt
28b61e032c Finish converting -7 to pwconf 2015-06-07 15:54:57 +00:00
bapt
87cd2261fe Handle -7 via gloval pwconf 2015-06-07 15:33:08 +00:00
bapt
9f5d2c6d19 Initialize conf using menset(3) 2015-06-07 15:29:58 +00:00
bapt
4ca3925ed2 Handle pretty print (-P) via global pwconf 2015-06-07 15:27:17 +00:00
bapt
720254061f Handle dryrun (-N) via global pwconf 2015-06-07 15:09:53 +00:00
bapt
cdf878c881 Sort headers 2015-06-07 14:57:16 +00:00
bapt
c79845f9d0 Handle -C and -Y locally and stop adding them to arglist 2015-06-07 14:54:07 +00:00
bapt
c6afeed630 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
bapt
c31a38b994 Fix pw userdel -r not deleting homedir 2015-06-07 14:32:52 +00:00
bapt
1844f29e51 Test explicitly the result of strcmp to be consistent with the rest of the code 2015-06-07 11:38:26 +00:00
bapt
0aa79fb06d Improve readability by reducing indentations levels 2015-06-07 11:35:34 +00:00
bapt
bb815be56e Remove one level of indentation 2015-06-07 11:30:33 +00:00
bapt
036d73e010 Move user deletion code into a separate function to improve readability 2015-06-07 11:26:28 +00:00
bapt
3b86c3ab1d 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
gjb
05099a39d9 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
bapt
c6995b5046 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