1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

Rename privatekey_free() to be consistent with publickey_free().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@563 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-20 07:26:50 +00:00
parent a3c820cf94
commit 9704df65e3
5 changed files with 19 additions and 19 deletions

View File

@@ -252,7 +252,7 @@ PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename,
int type, const char *passphrase); int type, const char *passphrase);
STRING *publickey_to_string(PUBLIC_KEY *key); STRING *publickey_to_string(PUBLIC_KEY *key);
PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv); PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv);
void private_key_free(PRIVATE_KEY *prv); void privatekey_free(PRIVATE_KEY *prv);
STRING *publickey_from_file(SSH_SESSION *session, const char *filename,int *_type); STRING *publickey_from_file(SSH_SESSION *session, const char *filename,int *_type);
STRING *publickey_from_next_file(SSH_SESSION *session, const char **pub_keys_path, STRING *publickey_from_next_file(SSH_SESSION *session, const char **pub_keys_path,
const char **keys_path, char **privkeyfile, int *type, int *count); const char **keys_path, char **privkeyfile, int *type, int *count);

View File

@@ -360,7 +360,7 @@ error:
* SSH_AUTH_SUCCESS : Authentication success * SSH_AUTH_SUCCESS : Authentication success
* \see publickey_from_file() * \see publickey_from_file()
* \see privatekey_from_file() * \see privatekey_from_file()
* \see private_key_free() * \see privatekey_free()
* \see ssh_userauth_offer_pubkey() * \see ssh_userauth_offer_pubkey()
*/ */
@@ -471,7 +471,7 @@ error:
* SSH_AUTH_SUCCESS : Authentication success * SSH_AUTH_SUCCESS : Authentication success
* \see publickey_from_file() * \see publickey_from_file()
* \see privatekey_from_file() * \see privatekey_from_file()
* \see private_key_free() * \see privatekey_free()
* \see ssh_userauth_offer_pubkey() * \see ssh_userauth_offer_pubkey()
*/ */
@@ -865,7 +865,7 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
} }
free(pubkey); free(pubkey);
free(privkeyfile); free(privkeyfile);
private_key_free(privkey); privatekey_free(privkey);
leave_function(); leave_function();
return err; return err;
} else } else
@@ -877,14 +877,14 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
pubkey=NULL; pubkey=NULL;
free(privkeyfile); free(privkeyfile);
privkeyfile=NULL; privkeyfile=NULL;
private_key_free(privkey); privatekey_free(privkey);
continue; continue;
} }
/* auth success */ /* auth success */
ssh_log(session, SSH_LOG_RARE, ssh_log(session, SSH_LOG_RARE,
"Authentication using %s success\n", privkeyfile); "Authentication using %s success\n", privkeyfile);
free(pubkey); free(pubkey);
private_key_free(privkey); privatekey_free(privkey);
free(privkeyfile); free(privkeyfile);
if(id){ if(id){
pub_keys_path[0]=NULL; pub_keys_path[0]=NULL;

View File

@@ -603,7 +603,7 @@ static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
* \param type Type of the private key. One of TYPE_DSS or TYPE_RSA. * \param type Type of the private key. One of TYPE_DSS or TYPE_RSA.
* \param passphrase Passphrase to decrypt the private key. Set to null if none is needed or it is unknown. * \param passphrase Passphrase to decrypt the private key. Set to null if none is needed or it is unknown.
* \returns a PRIVATE_KEY object containing the private key, or NULL if it failed. * \returns a PRIVATE_KEY object containing the private key, or NULL if it failed.
* \see private_key_free() * \see privatekey_free()
* \see publickey_from_privatekey() * \see publickey_from_privatekey()
*/ */
PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename, PRIVATE_KEY *privatekey_from_file(SSH_SESSION *session, const char *filename,
@@ -779,7 +779,7 @@ PRIVATE_KEY *_privatekey_from_file(void *session, const char *filename,
/** \brief deallocate a private key /** \brief deallocate a private key
* \param prv a PRIVATE_KEY object * \param prv a PRIVATE_KEY object
*/ */
void private_key_free(PRIVATE_KEY *prv) { void privatekey_free(PRIVATE_KEY *prv) {
if (prv == NULL) { if (prv == NULL) {
return; return;
} }

View File

@@ -159,7 +159,7 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){
rsa=_privatekey_from_file(ssh_bind,ssh_bind->options->rsakey,TYPE_RSA); rsa=_privatekey_from_file(ssh_bind,ssh_bind->options->rsakey,TYPE_RSA);
if(!rsa){ if(!rsa){
if(dsa) if(dsa)
private_key_free(dsa); privatekey_free(dsa);
return NULL; return NULL;
} }
} }
@@ -168,9 +168,9 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){
ssh_set_error(ssh_bind,SSH_FATAL,"Accepting a new connection: %s", ssh_set_error(ssh_bind,SSH_FATAL,"Accepting a new connection: %s",
strerror(errno)); strerror(errno));
if(dsa) if(dsa)
private_key_free(dsa); privatekey_free(dsa);
if(rsa) if(rsa)
private_key_free(rsa); privatekey_free(rsa);
return NULL; return NULL;
} }
session=ssh_new(); session=ssh_new();
@@ -180,9 +180,9 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){
if (session->options == NULL) { if (session->options == NULL) {
ssh_set_error(ssh_bind, SSH_FATAL, "No space left"); ssh_set_error(ssh_bind, SSH_FATAL, "No space left");
if (dsa) if (dsa)
private_key_free(dsa); privatekey_free(dsa);
if (rsa) if (rsa)
private_key_free(rsa); privatekey_free(rsa);
ssh_cleanup(session); ssh_cleanup(session);
return NULL; return NULL;
} }
@@ -191,9 +191,9 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){
session->socket=ssh_socket_new(session); session->socket=ssh_socket_new(session);
if (session->socket == NULL) { if (session->socket == NULL) {
if (dsa) if (dsa)
private_key_free(dsa); privatekey_free(dsa);
if (rsa) if (rsa)
private_key_free(rsa); privatekey_free(rsa);
ssh_cleanup(session); ssh_cleanup(session);
return NULL; return NULL;
} }
@@ -310,11 +310,11 @@ static int dh_handshake_server(SSH_SESSION *session){
buffer_free(buf); buffer_free(buf);
/* free private keys as they should not be readable past this point */ /* free private keys as they should not be readable past this point */
if(session->rsa_key){ if(session->rsa_key){
private_key_free(session->rsa_key); privatekey_free(session->rsa_key);
session->rsa_key=NULL; session->rsa_key=NULL;
} }
if(session->dsa_key){ if(session->dsa_key){
private_key_free(session->dsa_key); privatekey_free(session->dsa_key);
session->dsa_key=NULL; session->dsa_key=NULL;
} }
buffer_add_u8(session->out_buffer,SSH2_MSG_KEXDH_REPLY); buffer_add_u8(session->out_buffer,SSH2_MSG_KEXDH_REPLY);

View File

@@ -125,8 +125,8 @@ void ssh_cleanup(SSH_SESSION *session) {
SAFE_FREE(session->client_kex.methods); SAFE_FREE(session->client_kex.methods);
SAFE_FREE(session->server_kex.methods); SAFE_FREE(session->server_kex.methods);
private_key_free(session->dsa_key); privatekey_free(session->dsa_key);
private_key_free(session->rsa_key); privatekey_free(session->rsa_key);
ssh_message_free(session->ssh_message); ssh_message_free(session->ssh_message);
ssh_options_free(session->options); ssh_options_free(session->options);