diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-11-12 23:02:32 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-11-12 23:02:32 +0800 |
commit | e60a84d0ed81365a4ac24f06d574b7accb6ab2bd (patch) | |
tree | 87045d7ef102f381be34e53940b32438d3599e77 /svr-kex.c | |
parent | f025277147104ae0de018ab139a6ece9709ebdde (diff) |
Various cleanups and fixes for warnings
--HG--
branch : ecc
Diffstat (limited to 'svr-kex.c')
-rw-r--r-- | svr-kex.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -64,18 +64,19 @@ void recv_msg_kexdh_init() { case DROPBEAR_KEX_CURVE25519: #if defined(DROPBEAR_ECDH) || defined(DROPBEAR_CURVE25519) ecdh_qs = buf_getstringbuf(ses.payload); - if (ses.payload->pos != ses.payload->len) { - dropbear_exit("Bad kex value"); - } #endif break; } + if (ses.payload->pos != ses.payload->len) { + dropbear_exit("Bad kex value"); + } send_msg_kexdh_reply(&dh_e, ecdh_qs); mp_clear(&dh_e); if (ecdh_qs) { buf_free(ecdh_qs); + ecdh_qs = NULL; } send_msg_newkeys(); @@ -132,8 +133,11 @@ static void svr_ensure_hostkey() { } if (link(fn_temp, fn) < 0) { + /* It's OK to get EEXIST - we probably just lost a race + with another connection to generate the key */ if (errno != EEXIST) { - dropbear_log(LOG_ERR, "Failed moving key file to %s", fn); + dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", fn, + strerror(errno)); /* XXX fallback to non-atomic copy for some filesystems? */ goto out; } @@ -151,14 +155,6 @@ out: { dropbear_exit("Couldn't read or generate hostkey %s", fn); } - - // directory for keys. - - // Create lockfile first, or wait if it exists. PID! - // Generate key - // write it, load to memory - // atomic rename, done. - } #endif |