summaryrefslogtreecommitdiffstats
path: root/src/legacy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/legacy.c')
-rw-r--r--src/legacy.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/legacy.c b/src/legacy.c
index ac9ace1..3285557 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -27,6 +27,7 @@
#include "config.h"
#include <libssh/priv.h>
+#include <libssh/session.h>
#include <libssh/server.h>
#include <libssh/buffer.h>
#include <libssh/pki.h>
@@ -239,12 +240,19 @@ ssh_private_key privatekey_from_base64(ssh_session session,
const char *b64_pkey,
int type,
const char *passphrase) {
+ ssh_auth_callback auth_fn = NULL;
+ void *auth_data = NULL;
ssh_private_key privkey;
ssh_key key;
(void) type; /* unused */
- key = pki_private_key_from_base64(session, b64_pkey, passphrase);
+ if (session->common.callbacks) {
+ auth_fn = session->common.callbacks->auth_function;
+ auth_data = session->common.callbacks->userdata;
+ }
+
+ key = pki_private_key_from_base64(b64_pkey, passphrase, auth_fn, auth_data);
if (key == NULL) {
return NULL;
}
@@ -266,13 +274,25 @@ ssh_private_key privatekey_from_file(ssh_session session,
const char *filename,
int type,
const char *passphrase) {
- ssh_key key;
+ ssh_auth_callback auth_fn = NULL;
+ void *auth_data = NULL;
ssh_private_key privkey;
+ ssh_key key;
int rc;
(void) type; /* unused */
- rc = ssh_pki_import_privkey_file(session, filename, passphrase, &key);
+ if (session->common.callbacks) {
+ auth_fn = session->common.callbacks->auth_function;
+ auth_data = session->common.callbacks->userdata;
+ }
+
+
+ rc = ssh_pki_import_privkey_file(filename,
+ passphrase,
+ auth_fn,
+ auth_data,
+ &key);
if (rc == SSH_ERROR) {
return NULL;
}