Bug in getent program
Mark Kettenis
kettenis@wins.uva.nl
Tue Jul 11 23:38:00 GMT 2000
There is a small bug in the getent program distributed with glibc.
Right now
$ getent services 25/tcp
doesn't give you anything, while
$ getent services 6400/tcp
(that's 25 in network byte order) gives you something like
smtp 25/tcp
Here's a fix.
Mark
2000-07-12 Mark Kettenis <kettenis@gnu.org>
* nss/getent.c (services_keys): Pass port number in network byte
order in call to getservbyport.
Index: nss/getent.c
===================================================================
RCS file: /cvs/glibc/libc/nss/getent.c,v
retrieving revision 1.3
diff -u -p -r1.3 getent.c
--- nss/getent.c 2000/01/12 10:27:23 1.3
+++ nss/getent.c 2000/07/12 06:37:58
@@ -366,7 +366,7 @@ services_keys (int number, char *key[])
*proto++ = '\0';
if (isdigit (key[i][0]))
- serv = getservbyport (atol (key[i]), proto);
+ serv = getservbyport (htons (atol (key[i])), proto);
else
serv = getservbyname (key[i], proto);
More information about the Libc-hacker
mailing list