]> git.sur5r.net Git - openldap/commitdiff
pass struct in_addr.s_addr*, not long*, to gethostbyaddr
authorHallvard Furuseth <hallvard@openldap.org>
Thu, 19 Nov 1998 03:02:33 +0000 (03:02 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Thu, 19 Nov 1998 03:02:33 +0000 (03:02 +0000)
clients/finger/main.c

index 0a53a63efba33c49e6039f58064256a0a3084a10..e873b2e2ce08f94ff30520191d40f662e2a80db8 100644 (file)
@@ -61,7 +61,6 @@ main( int argc, char **argv )
 {
        int                     i;
        char                    *myname;
-       unsigned long           mypeer = -1;
        struct hostent          *hp;
        struct sockaddr_in      peername;
        int                     peernamelen;
@@ -110,7 +109,6 @@ main( int argc, char **argv )
                        perror( "getpeername" );
                        exit( 1 );
                }
-               mypeer = (unsigned long) peername.sin_addr.s_addr;
        }
 
 #ifdef FINGER_BANNER
@@ -133,13 +131,12 @@ main( int argc, char **argv )
 #endif
        }
 
-       if ( dosyslog && mypeer != (unsigned long) -1 ) {
-               struct in_addr  addr;
-
-               hp = gethostbyaddr( (char *) &mypeer, sizeof(mypeer), AF_INET );
-               addr.s_addr = mypeer;
-               syslog( LOG_INFO, "connection from %s (%s)", (hp == NULL) ?
-                   "unknown" : hp->h_name, inet_ntoa( addr ) );
+       if ( dosyslog && !interactive ) {
+               hp = gethostbyaddr( (char *) &peername.sin_addr.s_addr,
+                                   sizeof(peername.sin_addr.s_addr), AF_INET );
+               syslog( LOG_INFO, "connection from %s (%s)",
+                       (hp == NULL) ? "unknown" : hp->h_name,
+                       inet_ntoa( peername.sin_addr ) );
        }
 
        do_query();