aboutsummaryrefslogtreecommitdiffstats
path: root/src/starter/starterwhack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/starter/starterwhack.c')
-rw-r--r--src/starter/starterwhack.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/starter/starterwhack.c b/src/starter/starterwhack.c
index d3c6fc532..67916395f 100644
--- a/src/starter/starterwhack.c
+++ b/src/starter/starterwhack.c
@@ -226,13 +226,14 @@ starter_whack_add_pubkey (starter_conn_t *conn, starter_end_t *end
{
const char *err;
static char keyspace[1024 + 4];
+ char buf[ADDRTOT_BUF];
whack_message_t msg;
init_whack_msg(&msg);
msg.whack_key = TRUE;
msg.pubkey_alg = PUBKEY_ALG_RSA;
- if (end->id && end->rsakey)
+ if (end->rsakey)
{
/* special values to ignore */
if (streq(end->rsakey, "")
@@ -242,18 +243,23 @@ starter_whack_add_pubkey (starter_conn_t *conn, starter_end_t *end
{
return 0;
}
- msg.keyid = end->id;
err = atobytes(end->rsakey, 0, keyspace, sizeof(keyspace), &msg.keyval.len);
if (err)
{
plog("conn %s/%s: rsakey malformed [%s]", connection_name(conn), lr, err);
return 1;
}
+ if (end->id)
+ {
+ msg.keyid = end->id;
+ }
else
{
- msg.keyval.ptr = keyspace;
- return send_whack_msg(&msg);
+ addrtot(&end->addr, 0, buf, sizeof(buf));
+ msg.keyid = buf;
}
+ msg.keyval.ptr = keyspace;
+ return send_whack_msg(&msg);
}
return 0;
}