]> andersk Git - openssh.git/blobdiff - authfd.c
- (djm) Stop shadow expiry checking from preventing logins with NIS. Based
[openssh.git] / authfd.c
index df5b16f67ae0ae3f2577ab96b6789cfea756065c..69d77d7dde95382210cc690d70fd06e85b8c5cc0 100644 (file)
--- a/authfd.c
+++ b/authfd.c
@@ -1,20 +1,20 @@
 /*
- * 
+ *
  * authfd.c
- * 
+ *
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
- * 
+ *
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
- * 
+ *
  * Created: Wed Mar 29 01:30:28 1995 ylo
- * 
+ *
  * Functions for connecting the local authentication agent.
- * 
+ *
  */
 
 #include "includes.h"
-RCSID("$Id$");
+RCSID("$OpenBSD: authfd.c,v 1.20 2000/06/20 01:39:38 markus Exp $");
 
 #include "ssh.h"
 #include "rsa.h"
@@ -24,12 +24,7 @@ RCSID("$Id$");
 #include "xmalloc.h"
 #include "getput.h"
 
-#ifdef HAVE_OPENSSL
 #include <openssl/rsa.h>
-#endif
-#ifdef HAVE_SSL
-#include <ssl/rsa.h>
-#endif
 
 /* Returns the number of the authentication fd, or -1 if there is none. */
 
@@ -69,7 +64,7 @@ ssh_get_authentication_socket()
  * ssh_get_authentication_socket().
  */
 
-void 
+void
 ssh_close_authentication_socket(int sock)
 {
        if (getenv(SSH_AUTHSOCKET_ENV_NAME))
@@ -113,7 +108,7 @@ ssh_get_authentication_connection()
  * memory.
  */
 
-void 
+void
 ssh_close_authentication_connection(AuthenticationConnection *ac)
 {
        buffer_free(&ac->packet);
@@ -145,7 +140,7 @@ ssh_get_first_identity(AuthenticationConnection *auth,
        msg[2] = 0;
        msg[3] = 1;
        msg[4] = SSH_AGENTC_REQUEST_RSA_IDENTITIES;
-       if (write(auth->fd, msg, 5) != 5) {
+       if (atomicio(write, auth->fd, msg, 5) != 5) {
                error("write auth->fd: %.100s", strerror(errno));
                return 0;
        }
@@ -222,8 +217,8 @@ ssh_get_next_identity(AuthenticationConnection *auth,
        *comment = buffer_get_string(&auth->identities, NULL);
 
        if (bits != BN_num_bits(n))
-               error("Warning: keysize mismatch: actual %d, announced %u",
-                     BN_num_bits(n), bits);
+               log("Warning: identity keysize mismatch: actual %d, announced %u",
+                   BN_num_bits(n), bits);
 
        /* Decrement the number of remaining entries. */
        auth->howmany--;
@@ -270,9 +265,9 @@ ssh_decrypt_challenge(AuthenticationConnection *auth,
        PUT_32BIT(buf, len);
 
        /* Send the length and then the packet to the agent. */
-       if (write(auth->fd, buf, 4) != 4 ||
-           write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) !=
-           buffer_len(&buffer)) {
+       if (atomicio(write, auth->fd, buf, 4) != 4 ||
+           atomicio(write, auth->fd, buffer_ptr(&buffer),
+           buffer_len(&buffer)) != buffer_len(&buffer)) {
                error("Error writing to authentication socket.");
 error_cleanup:
                buffer_free(&buffer);
@@ -343,7 +338,7 @@ error_cleanup:
  * be used by normal applications.
  */
 
-int 
+int
 ssh_add_identity(AuthenticationConnection *auth,
                 RSA * key, const char *comment)
 {
@@ -369,9 +364,9 @@ ssh_add_identity(AuthenticationConnection *auth,
        PUT_32BIT(buf, len);
 
        /* Send the length and then the packet to the agent. */
-       if (write(auth->fd, buf, 4) != 4 ||
-           write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) !=
-           buffer_len(&buffer)) {
+       if (atomicio(write, auth->fd, buf, 4) != 4 ||
+           atomicio(write, auth->fd, buffer_ptr(&buffer),
+           buffer_len(&buffer)) != buffer_len(&buffer)) {
                error("Error writing to authentication socket.");
 error_cleanup:
                buffer_free(&buffer);
@@ -431,7 +426,7 @@ error_cleanup:
  * meant to be used by normal applications.
  */
 
-int 
+int
 ssh_remove_identity(AuthenticationConnection *auth, RSA *key)
 {
        Buffer buffer;
@@ -450,9 +445,9 @@ ssh_remove_identity(AuthenticationConnection *auth, RSA *key)
        PUT_32BIT(buf, len);
 
        /* Send the length and then the packet to the agent. */
-       if (write(auth->fd, buf, 4) != 4 ||
-           write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) !=
-           buffer_len(&buffer)) {
+       if (atomicio(write, auth->fd, buf, 4) != 4 ||
+           atomicio(write, auth->fd, buffer_ptr(&buffer),
+           buffer_len(&buffer)) != buffer_len(&buffer)) {
                error("Error writing to authentication socket.");
 error_cleanup:
                buffer_free(&buffer);
@@ -514,7 +509,7 @@ error_cleanup:
  * by normal applications.
  */
 
-int 
+int
 ssh_remove_all_identities(AuthenticationConnection *auth)
 {
        Buffer buffer;
@@ -526,7 +521,7 @@ ssh_remove_all_identities(AuthenticationConnection *auth)
        buf[4] = SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES;
 
        /* Send the length and then the packet to the agent. */
-       if (write(auth->fd, buf, 5) != 5) {
+       if (atomicio(write, auth->fd, buf, 5) != 5) {
                error("Error writing to authentication socket.");
                return 0;
        }
This page took 0.042131 seconds and 4 git commands to generate.