aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-02 20:06:51 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-03 12:29:31 +0200
commitf3697a0d5cf98d5c6fb372aba35bfc895dfdd832 (patch)
tree315b9db31efd374730052ecb3aeb9d8b4a4730d1 /libssh/keyfiles.c
parent8f0d40a1dd759c74ae577fafaca6299430fe2002 (diff)
downloadlibssh-f3697a0d5cf98d5c6fb372aba35bfc895dfdd832.tar.gz
libssh-f3697a0d5cf98d5c6fb372aba35bfc895dfdd832.tar.xz
libssh-f3697a0d5cf98d5c6fb372aba35bfc895dfdd832.zip
keyfiles: Move the auth callback inside the HAVE_LIBGCRYPT ifdef.
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 978f83ef..df1e24f5 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -666,11 +666,12 @@ static int privatekey_type_from_file(FILE *fp) {
*/
ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
int type, const char *passphrase) {
- ssh_auth_callback auth_cb = NULL;
ssh_private_key privkey = NULL;
- void *auth_ud = NULL;
FILE *file = NULL;
#ifdef HAVE_LIBGCRYPT
+ ssh_auth_callback auth_cb = NULL;
+ void *auth_ud = NULL;
+
gcry_sexp_t dsa = NULL;
gcry_sexp_t rsa = NULL;
int valid;
@@ -704,10 +705,10 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
case SSH_KEYTYPE_DSS:
if (passphrase == NULL) {
if (session->callbacks && session->callbacks->auth_function) {
+#ifdef HAVE_LIBGCRYPT
auth_cb = session->callbacks->auth_function;
auth_ud = session->callbacks->userdata;
-#ifdef HAVE_LIBGCRYPT
valid = read_dsa_privatekey(file, &dsa, auth_cb, auth_ud,
"Passphrase for private key:");
} else { /* authcb */
@@ -743,10 +744,10 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
break;
case SSH_KEYTYPE_RSA:
if (passphrase == NULL) {
- if (session->callbacks && session->callbacks->auth_function) {
- auth_cb = session->callbacks->auth_function;
- auth_ud = session->callbacks->userdata;
+ if (session->callbacks && session->callbacks->auth_function) {
#ifdef HAVE_LIBGCRYPT
+ auth_cb = session->callbacks->auth_function;
+ auth_ud = session->callbacks->userdata;
valid = read_rsa_privatekey(file, &rsa, auth_cb, auth_ud,
"Passphrase for private key:");
} else { /* authcb */