summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
Commit message (Collapse)AuthorAgeFilesLines
* Teach pw(8) about how to use pw/gr API to reduce code duplicationBaptiste Daroussin2012-10-301-7/+51
| | | | MFC after: 2 months
* Do not treat empty name as an uid 0Baptiste Daroussin2012-10-011-1/+2
| | | | Reported by: Robert Bonomi <bonomi@mail.r-bonomi.com>
* Remove useless atoi(3), previous strspn(3) makes sure that a_name->val is aBaptiste Daroussin2012-10-011-2/+1
| | | | | | | | | number. This also allow pw user show to work as expected. PR: bin/172112 Submitted by: "Ilya A. Arkhipov" <rum1cro@yandex.ru> MFC after: 1 month
* Handle NULL return from crypt(3). Mostly from DragonFlyKevin Lo2012-02-221-1/+5
|
* In usr.sbin/pw/pw_user.c, use the correct printf length modifier for aDimitry Andric2011-12-171-1/+1
| | | | | | ptrdiff_t. MFC after: 1 week
* Backout r223115 which potentially caused a POLA violation, by restoringXin LI2011-07-311-1/+1
| | | | | | | | historic behavior (create the default base directory in pw.conf) before I came up with a better fix for this. Requested by: nwhitehorn Approved by: re (kib)
* Don't attempt to create the base directory when -d is specified.Xin LI2011-06-151-1/+1
| | | | MFC after: 1 month
* Stop hard-coding default directory mode as 0777.Jung-uk Kim2011-03-081-6/+4
|
* Do not let pw.conf(5) or -M option affect creation of basehome, e.g., /home.Jung-uk Kim2011-02-041-5/+5
| | | | | | | | | | When the basehome does not exist, it creates all intermediate directories as required, which is logically equivalent to mkdir(1) with -m and -p options. However, it modifies all intermediate directories, not just the final home directory unlike mkdir. This problem was introduced in two revisions, i.e., r1.59 (SVN r167919) and r1.60 (SVN r168044). MFC after: 1 month
* Revert the unrelated patch crept in the previous commit.Jung-uk Kim2010-10-051-5/+5
|
* Prefer pmap_unmapbios() over pmap_unmapdev(). The binary does not changeJung-uk Kim2010-10-051-5/+5
| | | | after this because pmap_unmapbios() is a macro for pmap_unmapdev() on amd64.
* Make pw(8) build without <utmp.h>.Ed Schouten2009-12-061-5/+0
| | | | | | The size of the username record in utmp files should not influence the maximum username length. Right now ut_user/ut_name is big enough, so in this case it's dead code anyway.
* Use arc4random_uniform() to avoid "modulo bias"Andrey A. Chernov2008-08-161-55/+2
| | | | | | Remove pw_getrand() unneded now: arc4random_uniform() is stronger then pw_getrand()'s MD5 tricks (inactive) and its active version, mixing arc4random() bytes in one, not make things better at all.
* - Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).Antoine Brodin2008-05-271-5/+7
| | | | | | | | | | | This makes blowfish password hashes look normal when set using pw(8)/adduser(8). [1] - Make it possible to have a '/' in the salt. PR: 121146 [1] Submitted by: Jaakko Heinonen [1] Approved by: rwatson (mentor) MFC after: 1 month
* Accept passwords which contain whitespace.Lukas Ertl2007-03-301-1/+1
| | | | PR: bin/53434
* Add home directory creation mode to pw.conf(5) and be a bitLukas Ertl2007-03-301-6/+6
| | | | more specific about the effect of the current umask on -M.
* Introduce the new option -M to allow to set the permissions ofLukas Ertl2007-03-261-4/+17
| | | | | | | | the user's newly created home directory. If omitted, it's derived from the current umask. PR: bin/16880, bin/83253 (partially), bin/104248 MFC in: 1 month
* Change /home symbolic link, so it will point to usr/home instead of /usr/home.Pawel Jakub Dawidek2005-07-311-1/+5
| | | | | | | | | | | | Previous symlink was confusing: # cd /jails/virtual_system_1/home # realpath . /usr/home ...and slower. OK'ed by: rwatson, phk
* Use strlcpy(3) to replace the idiomaticRobert Drehmel2004-06-171-16/+10
| | | | | | | strncpy(d, s, l); d[l - 1] = '\0'; statements.
* Fix a bug which occurred when the home directory given by theRobert Drehmel2004-06-171-1/+2
| | | | | | | | -d option was equal to the one already saved and which caused the pw utility to avoid updating values passed by other options processed before the -d option in the code path. Spotted by: Richard Caley <rjc@interactive.co.uk>
* Add a `-H <fd>' option that is like `-h <fd>', but accepts an alreadyIan Dowse2004-01-111-11/+26
| | | | | | | encrypted password on the specified file descriptor. PR: bin/22033 MFC after: 2 weeks
* There is no sense to use random random() and arc4random() in the same program.Andrey A. Chernov2003-02-111-2/+1
| | | | Switch to arc4random() completely.
* Changes so the 'pw' command will allow '$' as the last character in a useridGarance A Drosehn2003-01-281-14/+51
| | | | | | | | | | | or group name (mainly for the benefit of samba). This pretty much rewrites he pw_checkname() routine, but should work exactly the same except for the above change, and that error messages are somewhat more informative. PR: 28733 46890 Inspired by: example patch written by Terry Lambert Reviewed by: no objections on freebsd-arch and freebsd-current MFC plans: no plans, but will do if people want it in stable.
* Print a long with %ld not %d. (We possibly should be using %j here, butDavid Malone2002-06-241-1/+1
| | | | | | | | that can be fixed when the many other warnings here are being fixed.) PR: 39741 Submitted by: Dan Lukes <dan@obluda.cz> MFC after: 1 week
* Change rmskey() to rmopie() - we don't have skey anymoreAndrey A. Chernov2001-10-191-6/+6
|
* For new users, create the home directory before sending the welcomeDima Dorfman2001-09-031-24/+24
| | | | | | | | mail, if configured to do so. Some sites have setups where the user's mail is delivered to their home directory, so sending mail before is exists didn't work. PR: 29892
* Properly initialize the random number generator in pw_getpass().Joerg Wunsch2001-08-211-0/+1
| | | | | | | Right now, the automatically generated passwords have been rather predictable. :-( MFC after: 1 day
* Fix a typo in a variable name that made pw(8) coredump when usingJoerg Wunsch2001-08-211-1/+1
| | | | | | USE_MD5RAND. MFC after: 2 days
* Use %c for expire/change datesAndrey A. Chernov2001-03-211-2/+2
|
* Switch from using rand() or random() to a stronger, more appropriate PRNGKris Kennaway2001-03-051-19/+2
| | | | | | (random() or arc4random()) Reviewed by: bde
* Convert to use the <sys/queue.h> macros rather than fiddling with the queueBen Smithurst2000-12-291-2/+2
| | | | | | structure internals. Reviewed by: markm
* Add working and easy crypt(3)-switching. Yes, we need a whole new APIBrian Feldman2000-08-221-1/+20
| | | | | | | | | | | | | | for crypt(3) by now. In any case: Add crypt_set_format(3) + documentation to -lcrypt. Add login_setcryptfmt(3) + documentation to -lutil. Support for switching crypt formats in passwd(8). Support for switching crypt formats in pw(8). The simple synopsis is: edit login.conf; add a passwd_format field set to "des" or "md5"; go nuts :) Reviewed by: peter
* Move test for -w flag outside of the code dealing with -D (defaults).David Nugent2000-07-201-2/+2
| | | | | | | This should cause -w's argument not to be ignored in the usermod case, so it will affect modification of the user's password instead of using the pw.conf (or internal default=no '*') password method. PR: bin/11168
* Allow -g with an empty argument in the -D case. This allows -g "" to setDavid Nugent2000-07-201-5/+8
| | | | | no default group (and thus fall back to user-based groups instead). PR: bin/5717
* Fix another missed case where usermod would not set the "modified" flag:David Nugent2000-07-201-3/+6
| | | | | | -h - to set no password. But only mark modified if the account is not already locked (i.e. first char of crypt password field is '*'). PR: bin/19999
* Fix breakage introduced by bypassing update for additional 'mod'David Nugent2000-07-031-0/+1
| | | | | | | functionality when nothing had actually changed; -d changes would not set the 'something had changed flag'. Actually test for a change in homedir. PR: bin/19649
* Localize ctype too.Andrey A. Chernov2000-06-241-2/+2
| | | | Add weekday to showuser expired fields
* Localize time/date.Andrey A. Chernov2000-06-221-10/+10
| | | | | Use ISO 8601 date in logs. Fix wrong argument type in ctype functions.
* Fix obvious braino in assignment statement. usermod -g should work again.David Nugent2000-06-181-1/+1
| | | | | PR: 17877 Submitted by: pius@zyan.com
* Fix a long-standing bug in the rename case previously masked by another bugDavid Nugent2000-06-181-2/+10
| | | | just fixed in .db file updating.
* Portability fixes for other bsd4.4 derivatives.David Nugent2000-01-151-10/+12
|
* Don't try updating the passwd file if no data has changed. This allows thingsDavid Nugent1999-10-261-39/+102
| | | | | | like "pw usermod <name> -m" to work for non-local NIS users; since no attempt is made to update the password entry, the home directory will be created and populated as expected without error.
* Add new functionality "lock" and "unlock" to provide a simple passwordDavid Nugent1999-10-261-2/+31
| | | | | | 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-21/+49
| | | | | | | | | | | | 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
|
* Remove some more warnings.David Nugent1999-07-281-2/+3
|
* Add the ability to print user records in unix version 7 (old) format.David Nugent1999-03-021-8/+15
|
* 1) Do not blindly ignore file update errors which may occur due to concurrentDavid Nugent1999-02-231-83/+89
| | | | | | updating 2) Add -V <etcdir>, which allows maintaining user/group database in alternate locations other than /etc.
* Don't assume a_name is a number just because the first characterDag-Erling Smørgrav1999-02-081-2/+4
| | | | | | | is a digit. PR: bin/9484 Submitted by: Matthew D. Fuller <fullermd@futuresouth.com>
* -Clarification of last commit-Bill Fumerola1999-01-041-1/+1
| | | | | | | The char that the random letters and numbers are being pulled from is ended with a '\0'. Using sizeof() includes this '\0' in the 'pool' of possible characters. This patch decrements by one the size so we don't accidently end the new password prematurly.