summaryrefslogtreecommitdiffstats
path: root/usr.bin/getent/getent.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Prefer user names over numeric user IDskn2018-11-021-11/+11
| | | | | | Behave like chown(8) to prevent clobbering user names which are numbers. Prompted by and "this is how it should be" tedu, OK millert
* Use more appropiate types/limits around strtonum()kn2018-09-261-26/+25
| | | | | | | | | | 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
* Adjust alignment in hostsprint()kn2018-09-261-2/+2
| | | | | | | 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
* Use getnameinfo(2)kn2018-09-251-27/+15
| | | | | | | | | | 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
* usage() is voidkn2018-09-251-4/+3
| | | | OK tb
* Since each database that has the rpath promise only needs to access onemestre2018-09-251-9/+14
| | | | | | | | | | | | | | | | | | 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@
* Remove initial pledge(2) that doesn't give us much protection since it's somestre2018-09-251-4/+1
| | | | | | | | | 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@
* Hmm, SHELLSPRINT may be pointless, but keep it for consistency with other dbs.jca2016-02-011-3/+5
|
* Pointless #definejca2016-02-011-5/+3
| | | | | was: #define SHELLSPRINT printf("%s\n", sh)
* Fix YP user and group support in getent(1).doug2015-10-101-3/+3
| | | | | | | | | 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@
* must also pledge "getpw", because it will use getpw* and getgr* functions.deraadt2015-10-101-2/+2
| | | | discussed with doug and semarie
* Add pledge support to getent(1).doug2015-10-101-11/+19
| | | | | | | This pledges the superset of all requests for the various getent databases and then drops to the minimum for the chosen database. ok deraadt@
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-2/+2
| | | | | | | | | 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)
* tedu networks(5) support;schwarze2014-10-241-45/+1
| | | | OK florian@ henning@
* As reported by Marcus Merighi, hosts enumeration no longer works.schwarze2014-10-201-5/+4
| | | | | | | | | | 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@.
* Use getaddrinfo() to display multiple addresses including IPv6.florian2013-03-301-6/+43
| | | | | | Pointed out by todd@. "The approach seems fine." deraadt@ OK todd@
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | 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@
* getservbyport() wants network byte order; from NetBSDotto2006-05-071-2/+2
|
* Include arpa/inet.h after netinet/in.h, not before. deraadt@ OKmillert2006-03-121-4/+4
|
* various cleanups, work with ottoderaadt2005-11-101-162/+62
|
* Introducing getent(1) from NetBSD. ok deraadt@otto2005-11-101-0/+578