]> jfr.im git - solanum.git/commitdiff
ident: Check getsockname() return value.
authorJilles Tjoelker <redacted>
Fri, 20 Jun 2008 23:27:17 +0000 (01:27 +0200)
committerJilles Tjoelker <redacted>
Fri, 20 Jun 2008 23:27:17 +0000 (01:27 +0200)
src/s_auth.c

index 9ae504c07c30b22b4da4bdfe7c9aec6c59eae0a4..672cb6dacfc48c8c8392e197b8a855edb11cac6e 100644 (file)
@@ -332,8 +332,13 @@ start_auth_query(struct AuthRequest *auth)
         * and machines with multiple IP addresses are common now
         */
        memset(&localaddr, 0, locallen);
-       getsockname(rb_get_fd(auth->client->localClient->F),
-                   (struct sockaddr *) &localaddr, &locallen);
+       if(getsockname(rb_get_fd(auth->client->localClient->F),
+                   (struct sockaddr *) &localaddr, &locallen) == -1)
+       {
+               /* can happen if connection was just closed */
+               rb_close(F);
+               return 0;
+       }
        
        /* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
 #ifdef RB_IPV6