This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] rexec's 2nd argument should be network order


Hi!

In glibc 2.1.x, the rport argument from rexec is passed directly into
sin_port (ie. it is network byte order), similarly Irix manpage for exec
suggest using getservbyname("exec","tcp")->s_port to be passed as second
argument to rexec.
But in current CVS we snprintf it into buffer and if I understand right
getaddrinfo later on does a strtoul on this, converts the result using
htons() and passes that into sin_port.

2000-10-11  Jakub Jelinek  <jakub@redhat.com>

	* inet/rexec.c (rexec_af): Convert rport to host order before
	passing it to snprintf.

--- libc/inet/rexec.c.jj	Wed May 31 23:02:40 2000
+++ libc/inet/rexec.c	Wed Oct 11 19:55:12 2000
@@ -65,7 +65,7 @@ rexec_af(ahost, rport, name, pass, cmd, 
 	int gai;
 	char servbuff[NI_MAXSERV];
 
-	snprintf(servbuff, sizeof(servbuff), "%d", rport);
+	snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
 	servbuff[sizeof(servbuff) - 1] = '\0';
 
 	memset(&hints, 0, sizeof(hints));

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]