summaryrefslogtreecommitdiffstats
path: root/pw/pw_group.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix pkg groupshow <gid>Baptiste Daroussin2016-12-101-1/+1
| | | | | | PR: 204676 Submitted by: longwitz@incore.de MFC after: 2 days
* Fix typo preventing pw {user,group}next -C from working as expectedBaptiste Daroussin2016-06-041-1/+1
| | | | | Reported by: Mike Selnet via forums.freebsd.org MFC after: 3 days
* Restore dryrun support for pw groupmodBaptiste Daroussin2015-12-281-0/+5
|
* Initialize `quiet` to false so `pw groupnext` again prints out the next gidEnji Cooper2015-10-191-1/+1
| | | | | | | | | by default Reported by: Florian Degner <f.degner@gmx.de> MFC after: 1 week PR: 203876 Sponsored by: EMC / Isilon Storage Division
* Avoid calling strlen() where we can use the strspn() return value.Ed Schouten2015-08-031-4/+4
|
* Split some extra long linesBaptiste Daroussin2015-08-021-2/+4
|
* Cleanup a bit includesBaptiste Daroussin2015-08-021-2/+2
|
* Fix regression: report if a group already exists when creating itBaptiste Daroussin2015-08-021-0/+2
|
* Rewrite parsing subcommands arguments of pw(8)Baptiste Daroussin2015-08-021-246/+511
| | | | | | | | | | | | | 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.
* Cast uid/git to uintmax_t when using printf-like functions so the size ofBaptiste Daroussin2015-08-011-3/+4
| | | | uid/gid size remains a implementation detail
* Remove now unused variableBaptiste Daroussin2015-07-111-3/+0
|
* Rework groupmod modification:Baptiste Daroussin2015-07-111-61/+29
| | | | | Use gr_add(3) when possible to avoid code duplication. Use a simpler logic to delete members of a group
* Make a separate groupdel/userdel from the main functionBaptiste Daroussin2015-07-111-17/+27
|
* Make separate functions to show users and groupsBaptiste Daroussin2015-07-111-16/+35
|
* Move the quiet flag into the configuration structureBaptiste Daroussin2015-07-111-1/+1
|
* Separate usernext/groupnext from the main functionsBaptiste Daroussin2015-07-111-12/+15
|
* Do not try to set password on group if the group is added as a consequence ofBaptiste Daroussin2015-07-091-1/+1
| | | | | | of creating a user (regression from r285136) Reported by: Fabian Keil <fk@fabiankeil.de>
* Also validate inputs of pw groupmod -h and groupmod -HBaptiste Daroussin2015-07-041-46/+46
|
* backout remove of -q option for pw [user|group] nextBaptiste Daroussin2015-06-081-2/+5
| | | | | | 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.
* Fix typoBaptiste Daroussin2015-06-081-1/+1
|
* Remove '-q' support for pw [user|group] nextBaptiste Daroussin2015-06-071-5/+2
| | | | | | 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.
* Fix duplicate checkingBaptiste Daroussin2015-06-071-8/+7
|
* In case of rename validate the length of the new nameBaptiste Daroussin2015-06-071-5/+4
| | | | Check early that the new name fits MAXLOGNAME and store it in pwconf
* Refactor input validationBaptiste Daroussin2015-06-071-36/+26
| | | | | Mutualize code to validate inputs of both 'user' and 'group' command Test that the input name fits into MAXLOGNAME
* Handle pretty print (-P) via global pwconfBaptiste Daroussin2015-06-071-9/+7
|
* Handle dryrun (-N) via global pwconfBaptiste Daroussin2015-06-071-1/+1
|
* Add a new global struct pwconf to store etcpath, rootdir and struct userconfBaptiste Daroussin2015-06-071-1/+2
| | | | | Do not add anymore -R and -V to arglist Add an error message if both -V and -R are set in arguments
* Instead of always casting the pw_checkname input to u_char * and casting it backBaptiste Daroussin2015-06-071-2/+2
| | | | to char *, change pw_checkname to directly take char * in input
* Cast to gid_t for groups not uid_tBaptiste Daroussin2015-05-311-1/+1
|
* Remove useless cast in printf and printf-like functions:Baptiste Daroussin2015-05-311-4/+4
| | | | use %u for uid_t and gid_t
* Cast -1 to uid_t and bump WARNING level to 3Baptiste Daroussin2015-05-311-1/+1
|
* Make pw_user()/pw_group() more consitent about errorsBaptiste Daroussin2015-05-311-12/+9
| | | | | | | | 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)
* Revert r277652Baptiste Daroussin2015-01-261-5/+1
| | | | | | 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)
* Allow negative numbers in -u and -g optionsBaptiste Daroussin2015-01-241-1/+5
| | | | | PR: 196514 MFC after: 1 week
* Do not delete the group wheel when bad argument is passed to pw groupdel -gBaptiste Daroussin2014-10-281-0/+5
| | | | | | | | | | | | Check that the -g argument is actually a number, if not report an error. This argument is converted without checking with atoi(3) later so without this check it converts any alpha entries into 0 meaning it deletes the group wheel Add a regression test about it PR: 90114 Reported by: bkoenig@cs.tu-berlin.de MFC after: 1 week
* When a group is renamed then the group has been invalidated for sure.Baptiste Daroussin2014-10-281-3/+6
| | | | | | | | | In that case get the group information using the new name. Add a regression test about this bug PR: 193704 Reported by: az
* Stop pw(8) from segfaulting when given certain inputJulian Elischer2014-03-061-6/+13
| | | | | | | PR:187310 Submitted by: Kim Shrier Obtained from: bug MFC after: 1 week
* Fix a regression in "pw group show" introduced r242349:Baptiste Daroussin2012-12-271-1/+1
| | | | | | | print a newline after printing each group line. PR: bin/174731 Submitted by: Jan Beich <jbeich@tormail.org>
* Remove useless check for NULL prior to free.Eitan Adler2012-12-051-2/+1
| | | | | Approved by: cperciva MFC after: 2 weeks
* Teach pw(8) about how to use pw/gr API to reduce code duplicationBaptiste Daroussin2012-10-301-2/+3
| | | | MFC after: 2 months
* Add the groupmod '-d' option to pw to allow the deletion of existing usersSean Farley2008-02-231-15/+80
| | | | | | | | | | from a group without the need to perform the same operation by replacing the existing list via the '-M' option. The '-M' option requires someone to fetch the existing members with pw, deleting the undesired members from the list and sending the altered list back to pw. Approved by: wes (mentor) MFC after: 5 days
* style(9) (verified no object changes)Sean Farley2008-02-231-2/+1
| | | | | Approved by: wes (mentor) MFC after: 5 days
* Add a `-H <fd>' option that is like `-h <fd>', but accepts an alreadyIan Dowse2004-01-111-2/+9
| | | | | | | encrypted password on the specified file descriptor. PR: bin/22033 MFC after: 2 weeks
* Localize time/date.Andrey A. Chernov2000-06-221-2/+2
| | | | | Use ISO 8601 date in logs. Fix wrong argument type in ctype functions.
* Portability fixes for other bsd4.4 derivatives.David Nugent2000-01-151-3/+4
|
* Add new functionality "lock" and "unlock" to provide a simple passwordDavid Nugent1999-10-261-2/+4
| | | | | | locking mechanism for users. This works by prepending the string "*LOCKED*" to the password field in master.passwd to prevent successful decoding.
* Clean up error handling in fileupdate(), which now returns 0 on successDavid Nugent1999-10-261-5/+20
| | | | | | | | | | | | instead of a boolean. This replicated through he front-end sub-functions relating to add, delete, modify entries in passwd & group files Errno is now preserved so output of errc()/warnc() will be less obfuscated by subsequent errors when reporting the problem. Add more intelligent error handling when attempting to modify/delete NIS entries with no corresponding local database entry. [MFC to stable in a couple of weeks to keep both in sync]
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
|
* 1) Do not blindly ignore file update errors which may occur due to concurrentDavid Nugent1999-02-231-13/+12
| | | | | | updating 2) Add -V <etcdir>, which allows maintaining user/group database in alternate locations other than /etc.
* Use err(3) instead of local redefinition. Add rcsid string.Philippe Charnier1997-10-101-15/+19
|