summaryrefslogtreecommitdiff
path: root/usr.bin/getent
AgeCommit message (Collapse)Author
2021-10-11avoid arpa/nameser.h by improving the inet_pton/gethostbyaddr code toTheo de Raadt
use struct in6_addr + struct in_addr instead of a char buffer. ok millert
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2018-11-02Prefer user names over numeric user IDskn
Behave like chown(8) to prevent clobbering user names which are numbers. Prompted by and "this is how it should be" tedu, OK millert
2018-09-26Use more appropiate types/limits around strtonum()kn
Replace `long long id' with appropiate types and names, use smaller limits where applicable and move variable declarations up out of loops. This makes the code clearer and a tad simpler while staying consistent across databases. Feedback and OK millert
2018-09-26Adjust alignment in hostsprint()kn
hostsprint() reserves only 16 columns for IPs and prints one whitespace too many afterwards. Crank it up to 39 as per hostsaddrinfo() to align nicely. OK millert
2018-09-25Use getnameinfo(2)kn
This simplifies the code, makes it less address family specific and plays nicely with previously used getaddrinfo(2). While here, make function parameter `const', sort stack variables by size and nitpick PF_UNSPEC. OK millert
2018-09-25usage() is voidkn
OK tb
2018-09-25Since each database that has the rpath promise only needs to access oneRicardo Mestre
specific file (in read mode) we can add a 4th attribute to the struct getentdb to define each of those files, except for group/hosts/passwd dbs which will be assigned NULL to that attribute because all the necessary files they need to open are already whitelisted through pledge(2) via either dns or getpw promises. With that set we can then check if the 4th attribute (called unveil) is not NULL and in that case unveil(2) that specific file per each database. After a discussion with millert@ regarding YP then deraadt@ chimed in referring that when he wrote this code even though we can have YP mappings with several of these dbs "it doesn't mean that things use it, or should, or will" so adding unveil(2) here should not impact any YP environments. OK millert@ deraadt@
2018-09-25Remove initial pledge(2) that doesn't give us much protection since it's soRicardo Mestre
short lived, we either go directly exiting the program or just a few lines below we call pledge(2) again, where it actually should be, and with really reduced promises. Next commit will restrict further access to the filesystem through unveil(2). OK deraadt@ kn@
2016-02-01Hmm, SHELLSPRINT may be pointless, but keep it for consistency with other dbs.Jeremie Courreges-Anglas
2016-02-01Pointless #defineJeremie Courreges-Anglas
was: #define SHELLSPRINT printf("%s\n", sh)
2015-10-10Fix YP user and group support in getent(1).Doug Hogan
These should have been "stdio getpw" before, but they worked for non-YP environments. With YP, it won't work without "getpw". Reported by semarie@ and confirmed as a problem by miod@. ok deraadt@
2015-10-10must also pledge "getpw", because it will use getpw* and getgr* functions.Theo de Raadt
discussed with doug and semarie
2015-10-10Add pledge support to getent(1).Doug Hogan
This pledges the superset of all requests for the various getent databases and then drops to the minimum for the chosen database. ok deraadt@
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-10-24tedu networks(5) support;Ingo Schwarze
OK florian@ henning@
2014-10-20As reported by Marcus Merighi, hosts enumeration no longer works.Ingo Schwarze
The asr library no longer supports gethostent(3), and there is no reasonable way to implement it. Consequently, as suggested by guenther@, error out when hosts enumeration is requested. OK deraadt@ guenther@ florian@ Also remove the now useless calls to sethostent(3) and endhostend(3) as suggested by florian@.
2014-02-12mark up fixed strings to be passed as command line arguments using .Cm;Ingo Schwarze
from Jan Stary <hans at stare dot cz>
2013-03-30Use getaddrinfo() to display multiple addresses including IPv6.Florian Obser
Pointed out by todd@. "The approach seems fine." deraadt@ OK todd@
2011-08-19as with other list types, column lists generally do not need a Pp/-compactJason McIntyre
construct; this also sidesteps what seems to be a problem with mandoc, in that "-column -compact" seems to mess up the formatting. thus these pages should now have their lists formatted nicely (i.e. correctly aligned and with indent applied); as a side note, the fact that headers are not properly marked up is another issue which will be addressed separately (a mandoc fix is needed, i think). i have fudged a few of these to mark up properly, since the workaround does make sense for some pages. as another side note, i haven;t fixed man7, as i need to prepare a separate diff for kristaps and ingo.
2010-10-01more EXIT STATUS tweaks; from Daniel DickmanJason McIntyre
2010-09-29various EXIT STATUS fixes; from Daniel DickmanJason McIntyre
2010-01-03.Bl always requires .It, even in .Bl -column;Ingo Schwarze
syntax errors found by mandoc(1), also required to fix the mandoc build; feedback and ok jmc@ and sobrado@
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2007-05-31convert to new .Dd format;Jason McIntyre
2006-05-07getservbyport() wants network byte order; from NetBSDOtto Moerbeek
2006-03-12Include arpa/inet.h after netinet/in.h, not before. deraadt@ OKTodd C. Miller
2005-11-11remove nsswitch.conf stuff, and explain how lookup order is handled;Jason McIntyre
couple more tweaks; ok otto@
2005-11-10Fix HISTORY sectionOtto Moerbeek
2005-11-10various cleanups, work with ottoTheo de Raadt
2005-11-10$OpenBSD$Otto Moerbeek
2005-11-10Introducing getent(1) from NetBSD. ok deraadt@Otto Moerbeek