summaryrefslogtreecommitdiff
path: root/usr.sbin/user
AgeCommit message (Collapse)Author
2019-10-17Use -1 to indicate an invalid uid/gid, not UID_MAX and GID_MAX.Todd C. Miller
This is the userland portion. OK deraadt@ sashan@
2019-07-03snprintf/vsnprintf return < 0 on error, rather than -1.Theo de Raadt
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-06-28mkstemp() returns -1 on failureTheo de Raadt
2018-12-31A bad uid range on the command line should be a fatal error.Todd C. Miller
Based on a diff from Stefan R. Filipek.
2018-10-15Use user_from_uid(), uid_from_user(), group_from_gid() andTodd C. Miller
gid_from_group() when we are only checking whether an entry already exists. Fixes crashes caused by the getpw* pointer invalidation changes. OK bluhm@
2018-09-26Fix segfault in usermod -l by swapping one of the getpwnam(3) withRicardo Mestre
uid_from_user(3). This started happening a few days ago after the change to the pwcache in libc. OK millert@
2018-09-13Fix warnings caused by user_from_uid() and group_from_gid() nowTodd C. Miller
returning const char *.
2017-05-24Remove 2 unused parameters from copydotfiles functionRicardo Mestre
While here sort headers and add missing prototypes OK tb@
2017-05-12Replace memset(3) with explicit_bzero(3) on user(8) on sensitive dataRicardo Mestre
(passwords) as soon as they are not needed on memory anymore. OK millert@
2016-11-30Since pwp->pw_gid is equal to pwp->pw_uid then use the former instead inRicardo Mestre
creategid() function and in the failure message since it makes more sense in this chunck of code. OK millert@
2016-11-30Mitigate some fd leaks on user(8)Ricardo Mestre
OK millert@
2016-11-30note that no group is created if a group already exists when using =uid;Jason McIntyre
while here, clean the text up a bit; from mestre and myself
2016-11-30According to usermod(8) manpage if -g =uid is used it should create a new groupRicardo Mestre
with an unique UID, if it's not already created (not in the manpage), but this wasn't implemented. This implements that functionality similar to what NetBSD has, but with some corrections by adding a fd closure in case of failure and on the failure message itself which they got it wrong. OK tb@
2016-11-29remove all the (void) casts which are irrelevant. The remaining onesTheo de Raadt
should be fixed to do error checks. ok jsg
2016-11-29Correct a bit test introduced in user.c rev 1.111 that made it impossibleJonathan Gray
to set a password hash with usermod if an additional flag was specified. ok mestre@ tom@ jung@
2016-11-29Alistair Crooks rescinded the advertising clause of his user(8)Jonathan Gray
license in 2005 in NetBSD. https://mail-index.netbsd.org/source-changes/2005/11/25/0002.html
2016-08-16Xr encrypt(1) here as well to be consistent with useradd(8).Theo Buehler
ok jmc
2016-08-14Xr encrypt(1) in the explanation of the -p option.Theo Buehler
ok jmc
2016-08-10Remove the encrypted password length check. The admin should beTodd C. Miller
able to put whatever they like in the encrypted password field, regardless of whether it can be matched or not. Having this check just makes it harder to add new encrypted password functions. This also fixes "usermode -Z" which was the impetus for the change. OK benno@
2016-05-03Fix regression on usermod/userdel by calling getpwnam_shadow(3) and savingRicardo Mestre
passwd hash early, instead of getpwnam(3), then close fds by calling endpwent(3) and finally only call pledge(2) after it, otherwise on any modification to the user it would destroy the passwd hash and therefore forbidding him/her to login again to the machine. Reported and tested by Edgar Pettijohn <edgar ! pettijohn-web at com> According to deraadt@ "that looks better then"
2016-05-02When writing master.password entries, use %lld for time_t and castTodd C. Miller
to long long. OK ajacoutot@
2016-04-26Add pledge(2) promises independently on each user(8)'s functions as follows:Ricardo Mestre
useradd: stdio rpath wpath cpath fattr flock proc exec getpw id usermod: stdio rpath wpath cpath fattr flock proc exec getpw id userdel: stdio rpath wpath cpath fattr flock proc exec getpw id userinfo: stdio getpw groupadd: stdio rpath wpath cpath fattr flock getpw groupmod: stdio rpath wpath cpath fattr flock groupdel: stdio rpath wpath cpath fattr flock groupinfo: stdio getpw This was extensively tested by me and tim@ who found some issues on my first versions. deraadt@ prodded me to commit this now to check who uses it in order to report back any fallbacks with the diff, if you find any please inform us.
2016-03-30for some time now mandoc has not required MLINKS to functionJason McIntyre
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-03-29If program cannot reserve memory then the user doesn't need to know exactly howRicardo Mestre
many bytes it couldn't allocate Suggested and OK from natano@ and millert@ also agrees
2016-03-29-Remove function #defines from defs.h and use the actual code accordingly inRicardo Mestre
user.c -Remove MIN and MAX #defines which are not being in use since the last 16 years -Move last #define to user.c and remove file defs.h -Remove lint comments OK natano@ after his suggestions and also OK jung@ on an earlier version
2016-03-28Remove cast from free(3)Ricardo Mestre
OK gsoares@
2016-03-28Remove handrolled #define FREE and use free(3) directly without wrappingRicardo Mestre
if (ptr!=NULL) around them since they are not needed. OK millert@ and jung@
2016-01-08Zap extraneous SYNOPSIS sections.Vadim Zhukov
The gettytab(5) and termcap(5) get FILES, others don't need anything. With input from & okay schwarze@
2015-11-30pledge regression: some operations appear to want to getpwent fromTheo de Raadt
spwd, then apply to a new password database. This runs into issues also with the new shadow routines. Needs to be looked at more, but for now remove pledge to make the shadow issues easier to figure out..
2015-11-15pledge "stdio rpath wpath cpath fattr getpw flock id proc exec" at theTheo de Raadt
top. It is a lot, maybe someone will take the time to find smaller chunks later in the program. tested by jca
2015-11-15Really silly to chmod "st_mode & 07777" when making a copy of theTheo de Raadt
group file, like entirely missing the point. ok jca
2015-09-12use .Cm for fixed string argumentsIngo Schwarze
2015-08-20stdlib.h is in scope; do not cast malloc/calloc/realloc*Theo de Raadt
ok millert krw
2015-04-24read_defaults has the thing for strtonum to chew on in cp, notDavid Gwynne
optarg. fixes a segfault introduced by the atoi to strtonum change and reported by ajacatout@
2015-04-23Replace atoi() usage with strtonum(). OK deraadt@Todd C. Miller
2015-03-13remove the first comma from constructs like ", and," and ", or,": you can useJason McIntyre
"and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-01use reallocarray() deep inside an macro ugly as sinTheo de Raadt
2014-08-27Add missing capability to handle new $2b version of blowfish passwordSebastian Reitenbach
encryption for usermod and friends. OK millert@, seems reasonable for now tedu@
2014-07-20Make sure the correct errno is reported by warn* or err* and notPhilip Guenther
the errno of an intervening cleanup operation like close/unlink/etc. Diff from Doug Hogan (doug (at) acyclic.org)
2013-11-23unsigned char casts for ctype; ok jcaTheo de Raadt
2013-09-10Move the chown and chmod out of copydotfiles() and add an explicitTodd C. Miller
check for skeldir set to the empty string. Fixes a problem where the owner/mode is not set on the user's homedir if the specified skeldir does not exist. OK ajacoutot@
2013-08-06Write uids/gids as unsigned in the passwd file and error messages.Todd C. Miller
This matches what pw_scan() expects. OK deraadt@
2013-07-16use .Mt for email addresses; from Jan Stary <hans at stare dot cz>; ok jmc@Ingo Schwarze
2013-04-02for parsing time values, fall back to atoll() for time_tTheo de Raadt
ok guenther
2013-03-04When locking/unlocking an account, never touch passwords that are "*"Antoine Jacoutot
or 13*. Also make sure to never endup with an empty password. cluebat and ok miod@
2013-02-16Fix unlocking on 32bits arch where it would fuck up the shell...Antoine Jacoutot
Do not try to (un)lock system users; people wanting to do so (???) will know what they do and use vipw(8). unlocking issue reported by Andre Stobe on tech@ cluesticks and ok miod@, ok deraadt@
2012-09-20Be consistent with what the installer and useradd(8) do and put newlyAntoine Jacoutot
created users into their own primary group. This does not change existing installations that already have a usermgmt.conf(5). ok todd@ beck@
2012-09-18Add 2 new knobs to usermod(8):Antoine Jacoutot
-U to unlock an account -Z to lock an account Locking means adding a '*' prefix to the encrypted password and appending a '-' to the user's shell... and obviously the opposite for unlocking. some inputs from sthen@, otto@ and deraadt@ ok todd@