summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix adding usergroup to new groupHayden2021-03-201-2/+2
|
* Fix issue where user not in /etc/shells main groupHayden2021-03-201-0/+2
|
* Untested libxcrypt-enabled passwordsHayden2021-03-201-12/+2
|
* pw(8): Fix userdel -rCameron Katri2021-03-201-5/+5
| | | | | | | Fix userdel -r: Remove check to see if uid is used by second user, which is failing after single user is removed Improve Makefile Disallow removing of apple's system users
* pw: fix building for iOS, completely untestedCameron Katri2021-02-101-26/+157
|
* pw: Handle errors from ftell() when removing records from /etc/opiekeys.Mark Johnston2020-09-011-5/+5
| | | | | | | Reported by: Coverity MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc.
* Remove an uneeded indentation introduced in r286196 to silence gcc warngingLi-Wen Hsu2019-05-251-1/+1
| | | | | MFC after: 3 days Sponsored by: The FreeBSD Foundation
* Allow the "@" and "!" characters in passwd file GECOS fields.David Bright2018-03-011-1/+1
| | | | | | | | | | | | | | | | Two PRs (152084 & 210187) request allowing the "@" and/or "!" characters in the passwd file GECOS field. The man page for pw does not mention that those characters are disallowed, Linux supports those characters in this field, and the "@" character in particular would be useful for storing email addresses in that field. PR: 152084, 210187 Submitted by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org> Reported by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org> Reviewed by: delphij (secteam), vangyzen MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14519
* pw(8): r326738 broke expiration arithmetic in case of `-D' flag not supplied.Eugene Grosbein2017-12-151-11/+12
| | | | | | | | | | | | Fix it and rename misnamed time_t variables `expire_days, password_days' (always holding absolute time) to `expire_time, password_time'. Add a comment for a case of overloading `cmdcnf->password_days' and `cmdcnf->expire_days' with absolute time. Reported by: markj Approved by: mav (mentor) MFC after: 1 week
* pw(8): correct expiration period handling and command line overridesEugene Grosbein2017-12-091-25/+43
| | | | | | | | | | | | | to preconfigured values for -e, -p and -w flags. Use non-negative symbols instead of magic values in passwd_val/pw_password functions. PR: 223431 Submitted by: Yuri Pankov (in part, patch for the manual) Reported by: mav (mentor) MFC after: 3 days Relnotes: yes
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended.
* pw useradd: Validate the user name before creating the entryEd Maste2017-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previouly it was possible to create users with spaces in the name with: pw useradd -u 1234 -g 1234 -n 'test user' The "-g 1234" is relevant, without it the name was already rejected as expected: [fk@test ~]$ sudo pw useradd -u 1234 -n 'test user' pw: invalid character ` ' at position 4 in userid/group name Bug unintentionally found with a salt config without explicit name entry: test user: user.present: - uid: 1234 - gid: 1234 - fullname: Test user - shell: /usr/local/bin/bash - home: /home/test - groups: - wheel - salt "Luckily" salt modules rarely bother with input validation either ... PR: 221416 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week
* pw usermod: Properly deal with empty secondary group lists (-G '')Ed Maste2017-08-191-2/+2
| | | | | | | | | | | | | | | "pw usermod someuser -G ''" is supposed make sure that someuser doesn't have any secondary group memberships. Previouly it was a nop because split_groups() only intitialised "groups" if at least one group was specified. As a result the existing secondary group memberships were kept. PR: 221417 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Relnotes: yes
* Don't depend on assert(3) getting evaluatedAlan Somers2017-05-101-1/+3
| | | | | | | Reported by: imp MFC after: 3 weeks X-MFC-With: 318141, 318143 Sponsored by: Spectra Logic Corp
* strcpy => strlcpyAlan Somers2017-05-101-1/+3
| | | | | | | Reported by: Coverity CID: 1006715 MFC after: 3 weeks Sponsored by: Spectra Logic Corp
* Properly initialise with content of pw.conf(5) that was mistakenly ignored.Eugene Grosbein2017-03-241-2/+5
| | | | | | | | | | Also, respect "defaultgroup" if specified there. PR: 217934 Reported by: Victor Sudakov <vas@mpeks.tomsk.su> Reviewed by: bapt Approved by: bapt, vsevolod (mentor) MFC after: 1 week
* Really restore the old behaviour for pw usermod -mBaptiste Daroussin2017-01-221-9/+3
| | | | | | | | It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days
* Readd a feature lost in pw(8) refactoringBaptiste Daroussin2017-01-221-0/+4
| | | | | | | | | | pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after: 3 days
* pw should sanitize the argument of -w.Alan Somers2016-07-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise, it will silently disable the login for the selected account if the argument is unrecognizable. usr.sbin/pw/pw.h usr.sbin/pw/pw_conf.c usr.sbin/pw/pw_user.c Use separate rules to validate boolean parameters and passwd parameters. Error out if a password parameter cannot be parsed. usr.sbin/pw/tests/Makefile usr.sbin/pw/tests/crypt.c usr.sbin/pw/tests/pw_useradd.sh usr.sbin/pw/tests/pw_usermod.sh Add tests for the validation. Also, enhance existing password-related tests to actually validate that the correct hash is written to master.passwd. Reviewed by: bapt MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6840
* 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
* Remove some unneeded headersBaptiste Daroussin2016-03-261-2/+0
| | | | Found by 'include-what-you-use'
* Fix a typo that prevented pw(8) from setting a user's UID to 0.Mark Johnston2016-03-021-1/+1
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* pw_checkname since the beginning if too strict on GECOS field,Baptiste Daroussin2015-12-021-1/+2
| | | | | | | | | | | relax it a bit so gecos can be used to store multibytes data. This was unseen before FreeBSD 10.2 as this validation function was motly unused since FreeBSD 10.2 the usage of this function has been generalized to improve validation. Reported by: des MFC after: 1 week
* Fix handling of numeric-only names with pw lockBaptiste Daroussin2015-12-021-9/+12
| | | | | | | Add a regression test about it PR: 204968 MFC after: 1 week
* In pw_userlock, set 'name' to NULL when we encounter an all number stringXin LI2015-10-301-2/+3
| | | | | | | | because it is also used as an indicator of whether a name or an UID is being used and we may have undefined results as 'name' may contain uninitialized stack contents. MFC after: 2 weeks
* Fix unlikely memory leak.Bryan Drewery2015-10-291-1/+3
| | | | | | | It is unlikely since the first check in the function is that dir[0] is '/', but later code changes may make it real. Coverity CID: 1332104
* Regression: fix usershow -7Baptiste Daroussin2015-09-141-1/+1
| | | | | Submitted by: Dan McGregor (via IRC) MFC after: 2 days
* Regression: fix pw usermod -dBaptiste Daroussin2015-09-121-0/+1
| | | | | | | | | Mark the user has having been edited if -d option is passed to usermod and so the request change of home directory actually happen PR: 203052 Reported by: lenzi.sergio@gmail.com MFC after: 2 days
* Fix /home symlink creationBaptiste Daroussin2015-08-211-1/+1
| | | | Add regression test about it
* Fix useradd regression:Baptiste Daroussin2015-08-211-0/+66
| | | | | | | | Readd the function to create the parents home directory if it does not exists. if it is only a directory at the top level of the hierarchy symlink it into /usr as it used to be done before. Reported by: kevlo, adrian
* Regression: fix pw usermod -w xxxBaptiste Daroussin2015-08-141-0/+2
| | | | Reported by: gjb
* Avoid calling strlen() where we can use the strspn() return value.Ed Schouten2015-08-031-5/+5
|
* Fix bugs spotted by gccBaptiste Daroussin2015-08-031-3/+4
| | | | Reported by: adrian
* Actually set quiet to something.Adrian Chadd2015-08-031-1/+1
| | | | | /usr/home/adrian/work/freebsd/head-embedded-2/src/usr.sbin/pw/pw_user.c: In function 'pw_user_next': /usr/home/adrian/work/freebsd/head-embedded-2/src/usr.sbin/pw/pw_user.c:680: warning: statement with no effect
* Split some extra long linesBaptiste Daroussin2015-08-021-5/+10
|
* Cleanup a bit includesBaptiste Daroussin2015-08-021-10/+15
|
* Fix regression: report again if a username already exists when creating itBaptiste Daroussin2015-08-021-0/+3
|
* Rewrite parsing subcommands arguments of pw(8)Baptiste Daroussin2015-08-021-923/+1248
| | | | | | | | | | | | | 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.
* Partial revert of r286152Baptiste Daroussin2015-08-011-4/+4
| | | | More work needed on the cli validation
* Validate expiration days and password days from commmand line and pw.confBaptiste Daroussin2015-08-011-4/+4
|
* Cast uid/git to uintmax_t when using printf-like functions so the size ofBaptiste Daroussin2015-08-011-16/+18
| | | | uid/gid size remains a implementation detail
* Reject usermod and userdel if the user concerned is not on the user databaseBaptiste Daroussin2015-07-281-0/+19
| | | | | | | | | | | | | 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
* Fix wrong warning printed after changing or updating NIS usersBaptiste Daroussin2015-07-281-2/+2
| | | | | PR: 37672 Submitted by: chris+freebsd@chrullrich.de
* Regression fix: allow to create users with uid0Baptiste Daroussin2015-07-131-1/+1
| | | | Reported by: Jan Mikkelsen <janm@transactionware.com>
* Ensure skeldir is abolute path (relatively to the rootdir)Baptiste Daroussin2015-07-121-4/+10
|
* pw -R <rootdir> userdel can now cleanup installationBaptiste Daroussin2015-07-121-56/+50
| | | | | | | 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
* Rework the home directory creation and copy or the skel content to use *atBaptiste Daroussin2015-07-121-9/+8
| | | | | | | | | 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
* Make getarg return NULL if args is NULLBaptiste Daroussin2015-07-121-4/+1
|
* Fix regression: ensure when try to create the group and the user with the sameBaptiste Daroussin2015-07-111-12/+4
| | | | id if possible and nothing in particular was specified
* Replace custom string array with stringlist(3)Baptiste Daroussin2015-07-111-10/+6
|