Hi Ingo,
On Sun, Oct 19, 2014 at 02:24:27AM +0200, Ingo Schwarze wrote:
> Hi Philip,
>
> Philip Guenther wrote on Sat, Oct 18, 2014 at 04:38:09PM -0700:
>
> > Maybe we just fix getent(1) to return an error like it does for ethers?
>
> Whatever we do with gethostent(3) - maybe it's really expendable,
> maybe tons of ports depend on it, who knows - i'm fine with
> removing hosts enumeration support from getent(1).
>
> Almost the same can be accomplished with
>
> cat /etc/hosts
>
> and with more clarity as to what it does and what the shortcomings are.
thanks for looking into it, this has been on my not-todo pile for quite some
time. :)
>
> That would be the following patch:
You can get rid of sethostent(3)/endhostent(3) at the same time. They
are stups in asr and even if they weren't they serve no purpose with
gethostent(3) gone, tweaked patch at the end.
witht that OK florian@
>
> Yours,
> Ingo
>
diff --git getent.c getent.c
index d991d0c..f479d67 100644
--- getent.c
+++ getent.c
@@ -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;
}
--
I'm not entirely sure you are real.