aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-09-23 21:30:56 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-09-23 21:30:56 +0200
commit5bd38a5f376772cc4be5d59d8cfa9a6ff9a517cf (patch)
tree883fa0fdb2a0964ef161521cebb3b70379d621ff /libssh/keyfiles.c
parentab60d1d67847f2af20604f8890381a0cbbed0524 (diff)
downloadlibssh-5bd38a5f376772cc4be5d59d8cfa9a6ff9a517cf.tar.gz
libssh-5bd38a5f376772cc4be5d59d8cfa9a6ff9a517cf.tar.xz
libssh-5bd38a5f376772cc4be5d59d8cfa9a6ff9a517cf.zip
Changed the current callback sys to be scalable
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index c651d4c..e2dfaf7 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -586,9 +586,9 @@ static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
ssh_log(session, SSH_LOG_RARE,
"Trying to call external authentication function");
- if (session && session->options->auth_function) {
- if ((*session->options->auth_function)("Passphrase for private key:", buf, size, 0, 0,
- session->options->auth_userdata ? session->options->auth_userdata : NULL) < 0) {
+ if (session && session->options->callbacks->auth_function) {
+ if (session->options->callbacks->auth_function("Passphrase for private key:", buf, size, 0, 0,
+ session->options->callbacks->userdata) < 0) {
return 0;
}
@@ -636,15 +636,14 @@ ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
ssh_log(session, SSH_LOG_RARE, "Trying to read %s, passphase=%s, authcb=%s",
filename, passphrase ? "true" : "false",
- session->options->auth_function ? "true" : "false");
+ session->options->callbacks->auth_function ? "true" : "false");
switch (type) {
case TYPE_DSS:
if (passphrase == NULL) {
- if (session->options->auth_function) {
- auth_cb = session->options->auth_function;
- if (session->options->auth_userdata) {
- auth_ud = session->options->auth_userdata;
- }
+ if (session->options->callbacks->auth_function) {
+ auth_cb = session->options->callbacks->auth_function;
+ auth_ud = session->options->callbacks->userdata;
+
#ifdef HAVE_LIBGCRYPT
valid = read_dsa_privatekey(file, &dsa, auth_cb, auth_ud,
"Passphrase for private key:");
@@ -681,11 +680,9 @@ ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
break;
case TYPE_RSA:
if (passphrase == NULL) {
- if (session->options->auth_function) {
- auth_cb = session->options->auth_function;
- if (session->options->auth_userdata) {
- auth_ud = session->options->auth_userdata;
- }
+ if (session->options->callbacks->auth_function) {
+ auth_cb = session->options->callbacks->auth_function;
+ auth_ud = session->options->callbacks->userdata;
#ifdef HAVE_LIBGCRYPT
valid = read_rsa_privatekey(file, &rsa, auth_cb, auth_ud,
"Passphrase for private key:");