diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-28 14:24:23 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-28 14:24:23 +0200 |
commit | be660e801a517a6b4c89bc30a84cad463eb2de7c (patch) | |
tree | 51309bfb86faa76c627e5f3b19cbb6193d9904f6 /src | |
parent | bce2c22e454504aa5586e815f01c5989b84ea9f8 (diff) | |
download | libssh-be660e801a517a6b4c89bc30a84cad463eb2de7c.tar.gz libssh-be660e801a517a6b4c89bc30a84cad463eb2de7c.tar.xz libssh-be660e801a517a6b4c89bc30a84cad463eb2de7c.zip |
keyfiles: Remove try_publickey_from_file().
Diffstat (limited to 'src')
-rw-r--r-- | src/pki_gcrypt.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c index 4935dee..cd89a6a 100644 --- a/src/pki_gcrypt.c +++ b/src/pki_gcrypt.c @@ -1524,87 +1524,4 @@ ssh_signature pki_do_sign_sessionid(const ssh_key key, #endif /* WITH_SERVER */ #endif /* HAVE_LIBGCRYPT */ -/** - * @addtogroup libssh_auth - * - * @{ - */ - -/** - * @brief Try to read the public key from a given file. - * - * @param[in] session The ssh session to use. - * - * @param[in] keyfile The name of the private keyfile. - * - * @param[out] publickey A ssh_string to store the public key. - * - * @param[out] type A pointer to an integer to store the type. - * - * @return 0 on success, -1 on error or the private key doesn't - * exist, 1 if the public key doesn't exist. - */ -ssh_string try_publickey_from_file(ssh_session session, struct ssh_keys_struct keytab, - char **privkeyfile, int *type) { - const char *priv; - const char *pub; - char *new; - ssh_string pubkey=NULL; - - pub = keytab.publickey; - if (pub == NULL) { - return NULL; - } - priv = keytab.privatekey; - if (priv == NULL) { - return NULL; - } - - if (session->sshdir == NULL) { - if (ssh_options_apply(session) < 0) { - return NULL; - } - } - - ssh_log(session, SSH_LOG_PACKET, "Trying to open publickey %s", pub); - if (!ssh_file_readaccess_ok(pub)) { - ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s", pub); - goto error; - } - - ssh_log(session, SSH_LOG_PACKET, "Trying to open privatekey %s", priv); - if (!ssh_file_readaccess_ok(priv)) { - ssh_log(session, SSH_LOG_PACKET, "Failed to open privatekey %s", priv); - goto error; - } - - ssh_log(session, SSH_LOG_PACKET, "Success opening public and private key"); - - /* - * We are sure both the private and public key file is readable. We return - * the public as a string, and the private filename as an argument - */ - pubkey = publickey_from_file(session, pub, type); - if (pubkey == NULL) { - ssh_log(session, SSH_LOG_PACKET, - "Wasn't able to open public key file %s: %s", - pub, - ssh_get_error(session)); - goto error; - } - - new = realloc(*privkeyfile, strlen(priv) + 1); - if (new == NULL) { - ssh_string_free(pubkey); - goto error; - } - - strcpy(new, priv); - *privkeyfile = new; -error: - return pubkey; -} - -/** @} */ - /* vim: set ts=4 sw=4 et cindent: */ |