Package: netkit-rsh Version: 0.17-14 Severity: wishlist Tags: patch Hi, I am using a linux server with an application accessed via rexec from many windows clients. These clients aren't recorded in any DNS, and obtain their IP addresses vi dhcp.
The current rexecd implementation in netkit require client to be registered in a DNS, otherwise print error "Where are you?". AIX version on rexecd has an option, -c, that skip this control, and accept any client. (The AIX manual page is available here: http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/share/man/info/en_US/a_doc_lib/cmds/aixcmds4/rexecd.htm) I wrote a patch for adding this option to the netkit implementation (both code and manual page). I would like to submit it for inclusion in the Debian package. Thanks a lot, Giuseppe
diff -ruN netkit-rsh-0.17/rexecd/rexecd.8 netkit-rsh-0.17.new/rexecd/rexecd.8 --- netkit-rsh-0.17/rexecd/rexecd.8 2000-07-31 01:57:04.000000000 +0200 +++ netkit-rsh-0.17.new/rexecd/rexecd.8 2008-02-07 10:41:40.000000000 +0100 @@ -39,7 +39,7 @@ .Nm rexecd .Nd remote execution server .Sh SYNOPSIS -.Nm rexecd +.Nm rexecd [\-c] .Sh DESCRIPTION .Nm Rexecd is the server for the @@ -56,6 +56,12 @@ is initiated: .Bl -enum .It +The server verify that the client has a valid hostname +associated in DNS, unless option \fB\-c\fP is specified. +If the client machine isn't accepted at this stage, the +error message 'Where are you?' is returned to the client +machine. +.It The server reads characters from the socket up to a NUL .Pq Ql \e0 @@ -64,7 +70,7 @@ .Tn ASCII number, base 10. .It -If the number received in step 1 is non-zero, +If the number received in step 2 is non-zero, it is interpreted as the port number of a secondary stream to be used for the .Em stderr . diff -ruN netkit-rsh-0.17/rexecd/rexecd.c netkit-rsh-0.17.new/rexecd/rexecd.c --- netkit-rsh-0.17/rexecd/rexecd.c 2008-02-07 10:43:16.000000000 +0100 +++ netkit-rsh-0.17.new/rexecd/rexecd.c 2008-02-07 10:20:51.000000000 +0100 @@ -120,8 +120,10 @@ struct sockaddr_storage from; struct sockaddr *const fromp = (void *)&from; socklen_t fromlen; + int namerequired = 1; - (void)argc; + if (argc>1) + namerequired = strcmp("-c", argv[1]); fromlen = sizeof(from); @@ -150,9 +152,21 @@ #else { char hbuf[NI_MAXHOST]; + int i; - if (getnameinfo(fromp, fromlen, - hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) { + i = getnameinfo(fromp, fromlen, + hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD); + if (i && !namerequired) { + long unsigned int ad4 = ((struct sockaddr_in *)fromp)->sin_addr.s_addr; + if (from.ss_family == AF_INET6) + syslog(LOG_ERR, "getnameinfo(family=AF_INET6) failed with code %d (%s).", i, gai_strerror(i)); + else { + sprintf(hbuf,"%lu.%lu.%lu.%lu", ad4&0xff, (ad4>>8)&0xff, (ad4>>16)&0xff, (ad4>>24)&0xff); + i = getnameinfo(fromp, fromlen, hbuf, sizeof(hbuf), NULL, 0, 0); + } + } + + if (i) { write(0, "\1Where are you?\n", 16); return 1; }