aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-09-08 15:47:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-09-08 15:58:53 +0200
commit2dd5d79feae6c8c455aa15dca23e7d0a451ddf9e (patch)
tree1caa6bc97f009faba493c9578afbd69185338a6b
parent3076632657aabdf029c6dd637853ab6371bea6c2 (diff)
downloadlibssh-2dd5d79feae6c8c455aa15dca23e7d0a451ddf9e.tar.gz
libssh-2dd5d79feae6c8c455aa15dca23e7d0a451ddf9e.tar.xz
libssh-2dd5d79feae6c8c455aa15dca23e7d0a451ddf9e.zip
pki: Use ssh_string_get_char().HEADlook
-rw-r--r--src/pki.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/pki.c b/src/pki.c
index 3dd27ed3..e34958be 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -661,7 +661,6 @@ int ssh_pki_import_pubkey_blob(const ssh_string key_blob,
ssh_key *pkey) {
ssh_buffer buffer;
ssh_string type_s = NULL;
- char *type_c = NULL;
enum ssh_keytypes_e type;
int rc;
@@ -688,15 +687,8 @@ int ssh_pki_import_pubkey_blob(const ssh_string key_blob,
goto fail;
}
- type_c = ssh_string_to_char(type_s);
- if (type_c == NULL) {
- ssh_pki_log("Out of memory!");
- goto fail;
- }
+ type = ssh_key_type_from_name(ssh_string_get_char(type_s));
ssh_string_free(type_s);
-
- type = ssh_key_type_from_name(type_c);
- free(type_c);
if (type == SSH_KEYTYPE_UNKNOWN) {
ssh_pki_log("Unknown key type found!");
goto fail;
@@ -710,7 +702,6 @@ int ssh_pki_import_pubkey_blob(const ssh_string key_blob,
fail:
ssh_buffer_free(buffer);
ssh_string_free(type_s);
- free(type_c);
return SSH_ERROR;
}
@@ -1030,7 +1021,6 @@ int ssh_pki_import_signature_blob(const ssh_string sig_blob,
enum ssh_keytypes_e type;
ssh_string str;
ssh_buffer buf;
- char *type_c;
int rc;
if (sig_blob == NULL || psig == NULL) {
@@ -1056,15 +1046,8 @@ int ssh_pki_import_signature_blob(const ssh_string sig_blob,
return SSH_ERROR;
}
- type_c = ssh_string_to_char(str);
+ type = ssh_key_type_from_name(ssh_string_get_char(str));
ssh_string_free(str);
- if (type_c == NULL) {
- ssh_buffer_free(buf);
- return SSH_ERROR;
- }
-
- type = ssh_key_type_from_name(type_c);
- SAFE_FREE(type_c);
str = buffer_get_ssh_string(buf);
ssh_buffer_free(buf);