summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-20 16:19:06 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-20 16:19:06 +0000
commitd07c1b250092fef4b640366189ebd36b57267a83 (patch)
tree3ce5f160bba2444e6a9b802622f4e2e583baa7ce
parent2e3ebfe845a2a48f6a41111e30066dff63f8c1f7 (diff)
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@.
-rw-r--r--usr.bin/getent/getent.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/getent/getent.c b/usr.bin/getent/getent.c
index d991d0cfb37..137173b4522 100644
--- a/usr.bin/getent/getent.c
+++ b/usr.bin/getent/getent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getent.c,v 1.6 2013/03/30 14:03:08 florian Exp $ */
+/* $OpenBSD: getent.c,v 1.7 2014/10/20 16:19:05 schwarze Exp $ */
/* $NetBSD: getent.c,v 1.7 2005/08/24 14:31:02 ginsbach Exp $ */
/*-
@@ -268,10 +268,10 @@ hosts(int argc, char *argv[])
int i, rv = RV_OK;
struct hostent *he;
- sethostent(1);
if (argc == 2) {
- while ((he = gethostent()) != NULL)
- hostsprint(he);
+ fprintf(stderr, "%s: Enumeration not supported on hosts\n",
+ __progname);
+ rv = RV_NOENUM;
} else {
for (i = 2; i < argc; i++) {
he = NULL;
@@ -285,7 +285,6 @@ hosts(int argc, char *argv[])
break;
}
}
- endhostent();
return rv;
}