]> andersk Git - openssh.git/blobdiff - authfd.c
- markus@cvs.openbsd.org 2001/04/14 16:27:57
[openssh.git] / authfd.c
index e2456e39eee3f0a794569983c5cd1b0e0684a104..3e1ef8182dd41c7e9e1ba0864672d9293ca85430 100644 (file)
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,9 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.32 2000/12/20 19:37:21 markus Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.39 2001/04/05 10:42:48 markus Exp $");
+
+#include <openssl/evp.h>
 
 #include "ssh.h"
 #include "rsa.h"
@@ -43,14 +45,13 @@ RCSID("$OpenBSD: authfd.c,v 1.32 2000/12/20 19:37:21 markus Exp $");
 #include "bufaux.h"
 #include "xmalloc.h"
 #include "getput.h"
-
-#include <openssl/rsa.h>
-#include <openssl/dsa.h>
-#include <openssl/evp.h>
 #include "key.h"
 #include "authfd.h"
+#include "cipher.h"
 #include "kex.h"
 #include "compat.h"
+#include "log.h"
+#include "atomicio.h"
 
 /* helper */
 int    decode_reply(int type);
@@ -74,10 +75,9 @@ ssh_get_authentication_socket(void)
 
        sunaddr.sun_family = AF_UNIX;
        strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
-#ifdef HAVE_SUN_LEN_IN_SOCKADDR_UN
-       sunaddr.sun_len = len = SUN_LEN(&sunaddr)+1;
-#else /* HAVE_SUN_LEN_IN_SOCKADDR_UN */
        len = SUN_LEN(&sunaddr)+1;
+#ifdef HAVE_SUN_LEN_IN_SOCKADDR_UN
+       sunaddr.sun_len = len;
 #endif /* HAVE_SUN_LEN_IN_SOCKADDR_UN */
 
        sock = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -120,6 +120,8 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
        len = 4;
        while (len > 0) {
                l = read(auth->fd, buf + 4 - len, len);
+               if (l == -1 && (errno == EAGAIN || errno == EINTR))
+                       continue;
                if (l <= 0) {
                        error("Error reading response length from authentication socket.");
                        return 0;
@@ -139,6 +141,8 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
                if (l > sizeof(buf))
                        l = sizeof(buf);
                l = read(auth->fd, buf, l);
+               if (l == -1 && (errno == EAGAIN || errno == EINTR))
+                       continue;
                if (l <= 0) {
                        error("Error reading response from authentication socket.");
                        return 0;
@@ -254,7 +258,7 @@ ssh_get_num_identities(AuthenticationConnection *auth, int version)
        /* Get the number of entries in the response and check it for sanity. */
        auth->howmany = buffer_get_int(&auth->identities);
        if (auth->howmany > 1024)
-               fatal("Too many identities in authentication reply: %d\n",
+               fatal("Too many identities in authentication reply: %d",
                    auth->howmany);
 
        return auth->howmany;
@@ -556,7 +560,7 @@ ssh_remove_all_identities(AuthenticationConnection *auth, int version)
        return decode_reply(type);
 }
 
-int 
+int
 decode_reply(int type)
 {
        switch (type) {
This page took 0.050846 seconds and 4 git commands to generate.