This patch makes clog (and perhaps other programs) work when the server
hostname has a '.' in it but is not an IP address, e.g. foo.bar.com

Works on my system, and inet_aton() is pretty standard, so it shouldn't
cause any problems...

-- Elliot
"In film you will find four basic story lines. Man versus man, man
 versus nature, nature versus nature, and dog versus vampire."
    - Steven Spielberg

--- coda-5.0.0/coda-src/auth2/auser.c.sopwith   Fri Jan 15 16:14:44 1999
+++ coda-5.0.0/coda-src/auth2/auser.c   Fri Jan 15 16:16:27 1999
@@ -52,6 +52,8 @@
 #include <sys/wait.h>
 #include <sys/ioctl.h>
 #include <sys/file.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <stdio.h>
@@ -318,14 +320,9 @@
     long rc;
     int len;
 
-    if (index(AuthHost, '.')){
-       int a, b, c, d;    
+    if(inet_aton(AuthHost, &hident.Value.InetAddress))
        hident.Tag = RPC2_HOSTBYINETADDR;
-       sscanf(AuthHost, "%d.%d.%d.%d", &a, &b, &c, &d);
-       d &= 0x000000ff;
-       d |= (((a << 24) & 0xff000000) | (b << 16 & 0x00ff0000) | ((c << 8) & 
0x0000ff00));
-       hident.Value.InetAddress.s_addr = htonl(d);
-    }else {
+    else {
        hident.Tag = RPC2_HOSTBYNAME;
        strcpy(hident.Value.Name, AuthHost);
     }

Reply via email to