*/
#include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.35 2001/02/04 15:32:22 stevesk Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.41 2001/06/23 15:12:17 itojun Exp $");
#include <openssl/evp.h>
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);
return sock;
}
-int
+static int
ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply)
{
int l, len;
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;
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;
/* 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;
/* Encode key for a message to the agent. */
-void
+static void
ssh_encode_identity_rsa1(Buffer *b, RSA *key, const char *comment)
{
buffer_clear(b);
buffer_put_bignum(b, key->iqmp); /* ssh key->u */
buffer_put_bignum(b, key->q); /* ssh key->p, SSL key->q */
buffer_put_bignum(b, key->p); /* ssh key->q, SSL key->p */
- buffer_put_string(b, comment, strlen(comment));
+ buffer_put_cstring(b, comment);
}
-void
+static void
ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment)
{
buffer_clear(b);