]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_auth.c
Yay for documenting code....
[irc/rqf/shadowircd.git] / src / s_auth.c
index 927c0d1de0343f502c49034d0b8536e88ae64408..a6143bb1124cfb5b467a74ecc030aa5211319e3e 100644 (file)
@@ -297,7 +297,6 @@ static int
 start_auth_query(struct AuthRequest *auth)
 {
        struct rb_sockaddr_storage localaddr, destaddr;
-       socklen_t locallen = sizeof(struct rb_sockaddr_storage);
        rb_fde_t *F;
        int family;
        
@@ -333,14 +332,7 @@ start_auth_query(struct AuthRequest *auth)
         * since the ident request must originate from that same address--
         * and machines with multiple IP addresses are common now
         */
-       memset(&localaddr, 0, 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;
-       }
+       localaddr = auth->client->preClient->lip;
        
        /* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
 #ifdef RB_IPV6
@@ -539,7 +531,7 @@ auth_connect_callback(rb_fde_t *F, int error, void *data)
        rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n",
                   auth->rport, auth->lport);
 
-       if(write(rb_get_fd(auth->F), authbuf, strlen(authbuf)) == -1)
+       if(rb_write(auth->F, authbuf, strlen(authbuf)) != strlen(authbuf))
        {
                auth_error(auth);
                return;
@@ -568,7 +560,7 @@ read_auth_reply(rb_fde_t *F, void *data)
        int count;
        char buf[AUTH_BUFSIZ + 1];      /* buffer to read auth reply into */
 
-       len = read(rb_get_fd(F), buf, AUTH_BUFSIZ);
+       len = rb_read(F, buf, AUTH_BUFSIZ);
 
        if(len < 0 && rb_ignore_errno(errno))
        {