diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-23 20:23:14 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-23 21:54:02 +0200 |
commit | 4c1d3b708c7bd6b52fe40dbf1a04089a1f406950 (patch) | |
tree | 5780d716038cb0ce2df152ed0b575d72f0b03a71 /src/legacy.c | |
parent | 379d65eaaf14c7ad699bb3752a5866ccb614f1af (diff) | |
download | libssh-4c1d3b708c7bd6b52fe40dbf1a04089a1f406950.tar.gz libssh-4c1d3b708c7bd6b52fe40dbf1a04089a1f406950.tar.xz libssh-4c1d3b708c7bd6b52fe40dbf1a04089a1f406950.zip |
auth: Make ssh_userauth_pubkey legacy.
Diffstat (limited to 'src/legacy.c')
-rw-r--r-- | src/legacy.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/legacy.c b/src/legacy.c index 58ee1be..50e8a93 100644 --- a/src/legacy.c +++ b/src/legacy.c @@ -60,6 +60,35 @@ int ssh_userauth_offer_pubkey(ssh_session session, const char *username, return rc; } +int ssh_userauth_pubkey(ssh_session session, + const char *username, + ssh_string publickey, + ssh_private_key privatekey) +{ + ssh_key key; + int rc; + + (void) publickey; /* unused */ + + key = ssh_key_new(); + if (key == NULL) { + return SSH_AUTH_ERROR; + } + + key->type = privatekey->type; + key->type_c = ssh_key_type_to_char(key->type); + key->flags = SSH_KEY_FLAG_PRIVATE|SSH_KEY_FLAG_PUBLIC; + key->dsa = privatekey->dsa_priv; + key->rsa = privatekey->rsa_priv; + + rc = ssh_userauth_publickey(session, username, key); + key->dsa = NULL; + key->rsa = NULL; + ssh_key_free(key); + + return rc; +} + /* BUFFER FUNCTIONS */ void buffer_free(ssh_buffer buffer){ |