OpenBSD CVS

CVS log for src/usr.bin/getent/getent.c


[BACK] Up to [local] / src / usr.bin / getent

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.23 / (download) - annotate - [select for diffs], Mon Oct 11 14:28:26 2021 UTC (2 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.22: +7 -7 lines
Diff to previous 1.22 (colored)

avoid arpa/nameser.h by improving the inet_pton/gethostbyaddr code to
use struct in6_addr + struct in_addr instead of a char buffer.
ok millert

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jul 12 15:09:19 2021 UTC (2 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Change the error reporting pattern throughout the tree when unveil
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@

Revision 1.21 / (download) - annotate - [select for diffs], Fri Nov 2 10:21:29 2018 UTC (5 years, 6 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.20: +11 -11 lines
Diff to previous 1.20 (colored)

Prefer user names over numeric user IDs

Behave like chown(8) to prevent clobbering user names which are numbers.

Prompted by and "this is how it should be" tedu, OK millert

Revision 1.20 / (download) - annotate - [select for diffs], Wed Sep 26 16:39:19 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.19: +25 -26 lines
Diff to previous 1.19 (colored)

Use more appropiate types/limits around strtonum()

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

Revision 1.19 / (download) - annotate - [select for diffs], Wed Sep 26 16:26:37 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

Adjust alignment in hostsprint()

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

Revision 1.18 / (download) - annotate - [select for diffs], Tue Sep 25 19:51:39 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.17: +15 -27 lines
Diff to previous 1.17 (colored)

Use getnameinfo(2)

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

Revision 1.17 / (download) - annotate - [select for diffs], Tue Sep 25 19:48:14 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.16: +3 -4 lines
Diff to previous 1.16 (colored)

usage() is void

OK tb

Revision 1.16 / (download) - annotate - [select for diffs], Tue Sep 25 06:48:48 2018 UTC (5 years, 7 months ago) by mestre
Branch: MAIN
Changes since 1.15: +14 -9 lines
Diff to previous 1.15 (colored)

Since each database that has the rpath promise only needs to access one
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@

Revision 1.15 / (download) - annotate - [select for diffs], Tue Sep 25 06:43:20 2018 UTC (5 years, 7 months ago) by mestre
Branch: MAIN
Changes since 1.14: +1 -4 lines
Diff to previous 1.14 (colored)

Remove initial pledge(2) that doesn't give us much protection since it's so
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@

Revision 1.14 / (download) - annotate - [select for diffs], Mon Feb 1 19:57:28 2016 UTC (8 years, 3 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.13: +4 -2 lines
Diff to previous 1.13 (colored)

Hmm, SHELLSPRINT may be pointless, but keep it for consistency with other dbs.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Feb 1 19:52:40 2016 UTC (8 years, 3 months ago) by jca
Branch: MAIN
Changes since 1.12: +3 -5 lines
Diff to previous 1.12 (colored)

Pointless #define

was:
#define SHELLSPRINT	printf("%s\n", sh)

Revision 1.12 / (download) - annotate - [select for diffs], Sat Oct 10 21:50:05 2015 UTC (8 years, 7 months ago) by doug
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

Fix YP user and group support in getent(1).

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@

Revision 1.11 / (download) - annotate - [select for diffs], Sat Oct 10 14:33:02 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

must also pledge "getpw", because it will use getpw* and getgr* functions.
discussed with doug and semarie

Revision 1.10 / (download) - annotate - [select for diffs], Sat Oct 10 05:26:57 2015 UTC (8 years, 7 months ago) by doug
Branch: MAIN
Changes since 1.9: +18 -10 lines
Diff to previous 1.9 (colored)

Add pledge support to getent(1).

This pledges the superset of all requests for the various getent databases
and then drops to the minimum for the chosen database.

ok deraadt@

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:08 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
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)

Revision 1.8 / (download) - annotate - [select for diffs], Fri Oct 24 10:23:32 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +1 -45 lines
Diff to previous 1.7 (colored)

tedu networks(5) support;
OK florian@ henning@

Revision 1.7 / (download) - annotate - [select for diffs], Mon Oct 20 16:19:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +4 -5 lines
Diff to previous 1.6 (colored)

As reported by Marcus Merighi, hosts enumeration no longer works.
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@.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Mar 30 14:03:08 2013 UTC (11 years, 1 month ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.5: +43 -6 lines
Diff to previous 1.5 (colored)

Use getaddrinfo() to display multiple addresses including IPv6.
Pointed out by todd@.
"The approach seems fine." deraadt@
OK todd@

Revision 1.5 / (download) - annotate - [select for diffs], Thu Jun 26 05:42:21 2008 UTC (15 years, 10 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.4: +1 -8 lines
Diff to previous 1.4 (colored)

First pass at removing clauses 3 and 4 from NetBSD licenses.

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@

Revision 1.4 / (download) - annotate - [select for diffs], Sun May 7 21:18:55 2006 UTC (18 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

getservbyport() wants network byte order; from NetBSD

Revision 1.3 / (download) - annotate - [select for diffs], Sun Mar 12 22:40:39 2006 UTC (18 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.2: +4 -4 lines
Diff to previous 1.2 (colored)

Include arpa/inet.h after netinet/in.h, not before.  deraadt@ OK

Revision 1.2 / (download) - annotate - [select for diffs], Thu Nov 10 20:07:14 2005 UTC (18 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.1: +62 -162 lines
Diff to previous 1.1 (colored)

various cleanups, work with otto

Revision 1.1 / (download) - annotate - [select for diffs], Thu Nov 10 19:24:36 2005 UTC (18 years, 6 months ago) by otto
Branch: MAIN

Introducing getent(1) from NetBSD. ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.