summaryrefslogtreecommitdiff
path: root/usr.sbin/user
AgeCommit message (Collapse)Author
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@
2012-01-29fix previous: grp is unused here just check the return valueAntoine Jacoutot
spotted by Jeremie Courreges-Anglas
2012-01-28Make it possible to remove a user from all secondary groups by using:Antoine Jacoutot
usermod -S '' username Original patch from jca at wxcvbn dot org. Added a comment to the man page. man tweaks and ok jmc@ ok miod@
2012-01-28When setting the groups (`-S'), make sure all provided groups exist inAntoine Jacoutot
the system otherwise we may end up removing all groups from a user. ok miod@
2012-01-12fgets(3) returns a pointer, so compare against NULL, not integer 0.Antoine Jacoutot
from Michael W. Bombardieri ok miod@
2011-12-31Remove the EXTENSIONS ifdef danse; it might have made sense in the pastAntoine Jacoutot
but user(8) behaviour has become OS specific in time so there's no sense keeping this. We are OpenBSD and we use BSD EXTENSIONS unconditionally. ok miod@ millert@ deraadt@
2011-12-30Fix a warning.Antoine Jacoutot
inputs from and ok miod@
2011-12-27Follow adduser(8) behaviour (as well as what the pkg tools and ourAntoine Jacoutot
installer do) and do not append the user to its primary group name in /etc/group. ok miod@
2011-12-24-p requires an argument; from Stefan PetterssonJason McIntyre
ok krw