summaryrefslogtreecommitdiffstats
path: root/lib/libutil/pw_util.c
Commit message (Collapse)AuthorAgeFilesLines
* Add O_CLOEXEC to flopenbapt2012-12-271-1/+1
| | | | Requested by: jilles
* Use flopen(3) instead of open(2) + flock(2)bapt2012-12-271-5/+2
|
* backout r242319, racy and not done in the right placebapt2012-10-291-9/+0
| | | | Reported by: Garrett Cooper <yanegomi@gmail.com>
* make pw_init and gr_init fail if the specified master password or group file isbapt2012-10-291-0/+9
| | | | | | a directory. MFC after: 1 month
* Revert user comparison back to user names as some user can share uids (root/toorbapt2012-06-191-6/+13
| | | | | | | | | | | for example) get the username information from old_pw structures to still allow renaming of a user. Reported by: Claude Buisson <clbuisson@orange.fr> Approved by: des (mentor) MFC after: 3 weeks
* Detect file modification properly by using tv_nsec.ed2012-02-101-1/+2
| | | | | | | POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. MFC after: 2 weeks
* Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwdbapt2012-01-051-1/+15
| | | | | | while here, fix missing parentheses of the return statement of pw_make. Approved by: des (mentor)
* Modify pw_copy:bapt2011-12-151-12/+29
| | | | | | | | | | | | | - if pw is NULL and oldpw is not NULL then the oldpw is deleted - if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid then it renames the user add new gr_* functions so now gr_util API is similar to pw_util API, this allow to manipulate groups in a safe way. Reviewed by: des Approved by: des MFC after: 1 month
* Old patch I had lying around: clean up and use stpcpy(3) instead ofdes2010-08-161-27/+34
| | | | sprintf(3).
* sigset() is the name of function specified by SUSv4.kib2009-11-261-4/+4
| | | | | | Replace it to avoid conflict. MFC after: 3 weeks
* Remove California Regent's clause 3, per letterimp2007-01-091-4/+0
|
* Minor comment fix.thomas2006-09-081-1/+1
|
* (pw_copy): Handle the case of a malformed line in master.passwdthomas2006-09-041-2/+11
| | | | | | | | (copy it silently, do not dereference NULL pointer). PR: bin/102848 Reviewed by: security-officer (cperciva) MFC after: 1 week
* Don't depend on NULL's expansion being a pointer, cast it before it is passedstefanf2004-05-181-3/+4
| | | | | | to variadic functions. Approved by: das (mentor)
* ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify.markm2003-10-181-29/+36
|
* Tidy up. Sort headers.markm2003-06-141-1/+1
|
* Brucify.des2003-04-101-4/+8
|
* Correctly detect the case where a password entry was changed while we weredes2003-04-091-2/+7
| | | | | | preparing to edit it. PR: bin/50563
* Apply the correct fix for bin/50679: don't mess around with process groupsdes2003-04-091-13/+19
| | | | | | | or the tty, just block selected signals in the parent like system(3) does. Many thanks to bde for his assistance in finding the correct solution. PR: bin/50679
* Band-aid for the "^C kills the editor" problem. I haven't yet found thedes2003-04-081-10/+6
| | | | | | | | proper way to fix this. The way this works is to prepend "exec " to the editor command to eliminate the "shell in the middle" which prevents us from properly reawakening the editor after a SIGTSTP. PR: bin/50679
* Make pw_edit() use /bin/sh to interpret the EDITOR environmentdas2003-03-171-2/+12
| | | | | | | variable. PR: 48748 Reviewed by: mike (mentor)
* Don't forget to '\n'-terminate new entries. This unbreaks chpass -a.des2002-10-291-1/+2
| | | | Submitted by: joerg
* Be more clear in error messages.n_hibma2002-06-231-4/+9
| | | | | | | Distinguish between a held lock and a failed lock op. If rpc.lockd is not running on a diskless client this makes clearer what the problem is.
* If no old_pw was passed to pw_copy, compare just the name.des2002-05-081-1/+2
| | | | Sponsored by: DARPA, NAI Labs
* Add passwd manipulation code based on parts of vipw and chpass.des2002-05-081-82/+404
| | | | Sponsored by: DARPA, NAI Labs
* Make mppath and masterpasswd pointers instead of arrays, and initializedes2002-04-171-2/+4
| | | | | | | | | them to point at static strings that contain the default paths. This makes 'vipw -d' work again (I broke it in rev 1.21; apologies for taking so long to fix it.) Spotted by: Olivier Houchard <doginou@cognet.ci0.org> Sponsored by: DARPA, NAI Labs
* Remove bogus reference to _use_yp.des2002-04-151-9/+1
|
* ANSIfy and constify.des2002-02-051-17/+15
| | | | Sponsored by: DARPA, NAI Labs
* Fix the type of the NULL arg to execl()brian2001-07-091-3/+3
| | | | Idea from: Theo de Raadt <deraadt@openbsd.org>
* Don't pass NULL to the %s format.dd2001-04-221-2/+6
| | | | Reviewed by: kris
* Don't call warn() without a format string.kris2000-07-121-1/+1
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Move call to umask(0) back into pw_util(), because the latterpb1999-06-291-1/+4
| | | | function is also used by chpass(1) and passwd(1).
* Force umask to 077 (instead of 000) during the edit phase, to getpb1999-06-261-4/+1
| | | | | | | | | | secure permissions in case the user attempts to save something to a file of his own. Move umask stuff out of pw_init() into main() for better visibility of overall umask tweaking logic. PR: misc/11797
* Add -d option to vipw(8) to allow selection of an alternative directorysheldonh1999-06-261-8/+14
| | | | | | | for the password files. PR: 2703 Submitted by: jmg
* oops. Fix indentation of the 'for' loop I just added.dillon1998-12-131-18/+18
|
* Handle the race condition where vipw may lock a password file which hasdillon1998-12-131-6/+22
| | | | | just been replaced. After our lock succeeds we check if st_nlink is 0 and if it is we close the descriptor and retry our open/lock sequence.
* Since vfork() was changed to fork(), we have to pass errno back from thedes1998-10-201-3/+6
| | | | | | | child to the parent somehow. PR: 8353 Submitted by: Andrew J. Korty <ajk@purdue.edu>
* Calls one or more of malloc(), warn(), err(), syslog(), execlp() ordes1998-10-131-3/+3
| | | | | | | | | | | execvp() in the child branch of a vfork(). Changed to use fork() instead. Some of these (mv, find, apply, xargs) might benefit greatly from being rewritten to use vfork() properly. PR: Loosely related to bin/8252 Approved by: jkh and bde
* Statisize usage().charnier1997-10-271-1/+4
|
* Changes to support full make parallelism (-j<n>) in the worldjkh1997-10-051-3/+3
| | | | | | target. Reviewed by: <many different folks> Submitted by: Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>
* Endless loop.wosch1997-09-291-5/+5
| | | | | | | | | | | $ vipw [corrupt a line in editor, exit editor] pwd_mkdb: corrupted entry pwd_mkdb: at line #2 pwd_mkdb: /etc/pw.012585: Inappropriate file type or format re-edit the password file? [y]: n^D^D [hang]
* Cosmetic: distinguish in diag message between rebuilding and updatingjoerg1997-08-241-1/+2
| | | | | | | the database. PR: 3397 Submitted by: taob@risc.org (Brian Tao)
* Implement incremental passwd database updates. This is done by ading a '-u'guido1996-07-011-2/+8
| | | | | | | | | | | | | | option to pwd_mkdb and adding this option to utilities invoking it. Further, the filling of both the secure and insecure databases has been merged into one loop giving also a performance improvemnet. Note that I did *not* change the adduser command. I don't read perl (it is a write only language anyway). The change will drastically improve performance for passwd and friends with large passwd files. Vipw's performance won't change. In order to do that some kind of diff should be made between the old and new master.passwd and depending the amount of changes, an incremental or complete update of the databases should be agreed upon.
* Small NIS tweak: frob pw_error() a little so that it can say eitherwpaul1995-08-131-1/+8
| | | | | | | | | 'NIS information unchanged' or '/etc/master.passwd unchanged' depending on which was is being modified (conditional on -DYP). This is to save me the trouble of writing a whole other error routine (nis_error()?) for the upcoming changes to passwd and chpass.
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
|
* Fix suspended vipw hangsache1995-03-091-9/+25
| | | | Obtained from: NetBSD
* BSD 4.4 Lite usr.sbin Sourcesrgrimes1994-05-261-0/+204
OpenPOWER on IntegriCloud