diff options
author | des <des@FreeBSD.org> | 2002-10-29 09:43:00 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-10-29 09:43:00 +0000 |
commit | 099d1a58f7bc088a9f71af6d32542ca3949468a3 (patch) | |
tree | 49cef8938d7beb10016662d15546fa090865073d /crypto/openssh/authfd.c | |
parent | 1ba793a7c09e24d920de3983a3223770cb37ebff (diff) | |
download | FreeBSD-src-099d1a58f7bc088a9f71af6d32542ca3949468a3.zip FreeBSD-src-099d1a58f7bc088a9f71af6d32542ca3949468a3.tar.gz |
Vendor import of OpenSSH-portable 3.5p1.
Diffstat (limited to 'crypto/openssh/authfd.c')
-rw-r--r-- | crypto/openssh/authfd.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/crypto/openssh/authfd.c b/crypto/openssh/authfd.c index 4c4552d5..f04e085 100644 --- a/crypto/openssh/authfd.c +++ b/crypto/openssh/authfd.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: authfd.c,v 1.56 2002/06/25 16:22:42 markus Exp $"); +RCSID("$OpenBSD: authfd.c,v 1.57 2002/09/11 18:27:26 stevesk Exp $"); #include <openssl/evp.h> @@ -53,6 +53,8 @@ RCSID("$OpenBSD: authfd.c,v 1.56 2002/06/25 16:22:42 markus Exp $"); #include "log.h" #include "atomicio.h" +static int agent_present = 0; + /* helper */ int decode_reply(int type); @@ -61,6 +63,21 @@ int decode_reply(int type); ((x == SSH_AGENT_FAILURE) || (x == SSH_COM_AGENT2_FAILURE) || \ (x == SSH2_AGENT_FAILURE)) +int +ssh_agent_present(void) +{ + int authfd; + + if (agent_present) + return 1; + if ((authfd = ssh_get_authentication_socket()) == -1) + return 0; + else { + ssh_close_authentication_socket(authfd); + return 1; + } +} + /* Returns the number of the authentication fd, or -1 if there is none. */ int @@ -90,6 +107,7 @@ ssh_get_authentication_socket(void) close(sock); return -1; } + agent_present = 1; return sock; } |