From c742137dc8c8dd2163a2353d3382fdf2cae44c24 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Mon, 6 Jul 2009 12:59:13 +0000 Subject: New standard linked list to use, rather than adhoc SignKeyList or TCPFwdList --HG-- branch : agent-client extra : convert_revision : 5465e639cc3f5ee0c6c55f0de6e7b6d5a8769da3 --- signkey.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'signkey.c') diff --git a/signkey.c b/signkey.c index c1ef5e2..9bc4845 100644 --- a/signkey.c +++ b/signkey.c @@ -40,8 +40,10 @@ sign_key * new_sign_key() { #ifdef DROPBEAR_RSA ret->rsakey = NULL; #endif + ret->filename = NULL; + ret->type = DROPBEAR_SIGNKEY_NONE; + ret->source = SIGNKEY_SOURCE_INVALID; return ret; - } /* Returns "ssh-dss" or "ssh-rsa" corresponding to the type. Exits fatally @@ -81,6 +83,9 @@ int signkey_type_from_name(const char* name, int namelen) { } #endif + TRACE(("signkey_type_from_name unexpected key type.")) + printhex("Key type", name, namelen); + return DROPBEAR_SIGNKEY_NONE; } @@ -101,8 +106,11 @@ int buf_get_pub_key(buffer *buf, sign_key *key, int *type) { m_free(ident); if (*type != DROPBEAR_SIGNKEY_ANY && *type != keytype) { + TRACE(("buf_get_pub_key bad type - got %d, expected %d", keytype, type)) return DROPBEAR_FAILURE; } + + TRACE(("buf_get_pub_key keytype is %d")) *type = keytype; @@ -255,6 +263,8 @@ void sign_key_free(sign_key *key) { key->rsakey = NULL; #endif + m_free(key->filename); + m_free(key); TRACE(("leave sign_key_free")) } @@ -358,7 +368,6 @@ void buf_put_sign(buffer* buf, sign_key *key, int type, const unsigned char *data, unsigned int len) { buffer *sigblob; - sigblob = buf_new(MAX_PUBKEY_SIZE); #ifdef DROPBEAR_DSS @@ -374,7 +383,6 @@ void buf_put_sign(buffer* buf, sign_key *key, int type, if (sigblob->len == 0) { dropbear_exit("non-matching signing type"); } - buf_setpos(sigblob, 0); buf_putstring(buf, buf_getptr(sigblob, sigblob->len), sigblob->len); -- cgit v1.2.3