Baptiste Daroussin
8159e0373f
Split some extra long lines
2015-08-02 13:33:17 +00:00
Baptiste Daroussin
9261982d92
Split some extra long lines
2015-08-02 13:32:23 +00:00
Baptiste Daroussin
bcbdb01e56
Cleanup a bit includes
2015-08-02 13:22:46 +00:00
Baptiste Daroussin
b8a5086ef0
Add regression tests about adding already existsing groups/users
2015-08-02 13:02:53 +00:00
Baptiste Daroussin
f4124312a1
Fix regression: report if a group already exists when creating it
2015-08-02 12:56:25 +00:00
Baptiste Daroussin
a64b90fbaa
Fix regression: report again if a username already exists when creating it
2015-08-02 12:54:15 +00:00
Baptiste Daroussin
db533440b7
Remove dead code
2015-08-02 12:48:36 +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
458fdd97ab
Remove things that crept in after badly checked revert
2015-08-01 12:20:55 +00:00
Baptiste Daroussin
7493058fb6
Partial revert of r286152
...
More work needed on the cli validation
2015-08-01 12:18:48 +00:00
Baptiste Daroussin
7391bf5ada
Fix build
2015-08-01 11:52:48 +00:00
Baptiste Daroussin
510113b84d
Fix formatting of new code
...
Fix sorting or errstr
Remove useless initialisation or errstr
Reported by: bde
2015-08-01 11:31:59 +00:00
Baptiste Daroussin
80d9f89289
Validate expiration days and password days from commmand line and pw.conf
2015-08-01 10:25:55 +00:00
Baptiste Daroussin
e5e7ef48eb
Validate the max_uid/max_gid boundaries and entry type in pw.conf
2015-08-01 10:10:13 +00:00
Baptiste Daroussin
50698e6718
Cast uid/git to uintmax_t when using printf-like functions so the size of
...
uid/gid size remains a implementation detail
2015-08-01 09:55:47 +00:00
Baptiste Daroussin
a86e343db6
Improve strtounum
...
Fix many style bugs
Better variable naming
Use C99 'restrict' were apropriate
Fix potential errno race
Submitted by: bde
2015-07-30 06:14:47 +00:00
Baptiste Daroussin
796ba6fcc2
Cleanup includes
2015-07-29 23:26:14 +00:00
Baptiste Daroussin
c308ef6fd2
Actually set the proper license
...
Reported by: trasz
2015-07-29 22:51:54 +00:00
Baptiste Daroussin
22665b2563
Actually add the new code
2015-07-29 06:23:06 +00:00
Baptiste Daroussin
8411215a80
Create a strtounum function using the same API as strtonum
...
This function returns uintmax_t
Use this function to convert to gid_t/uid_t
2015-07-29 06:22:41 +00:00
Baptiste Daroussin
bbdee3ebde
Reject usermod and userdel if the user concerned is not on the user database
...
supposed to be manipulated
This prevent pw usermod creating a new local user when requesting to usermod on
a username is defined in LDAP.
This issue only happens when modifying the local user database (not inpacting
commands when -V or -R are used).
PR: 187653
Submitted by: tmwalaszek@gmail.com
2015-07-28 21:49:38 +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
81e2ba845c
Fix wrong warning printed after changing or updating NIS users
...
PR: 37672
Submitted by: chris+freebsd@chrullrich.de
2015-07-28 20:52:10 +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
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