diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-12-09 07:24:43 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-12-09 07:24:43 +0100 |
commit | ee2679ec25a571ea5e4ba28e0fb87828f0a31432 (patch) | |
tree | d945172f191672853834630a637d2cdf9ebbde84 /src/starter/starterwhack.c | |
parent | a07531250eb074b870af675b54420fb8712ec641 (diff) | |
download | strongswan-ee2679ec25a571ea5e4ba28e0fb87828f0a31432.tar.bz2 strongswan-ee2679ec25a571ea5e4ba28e0fb87828f0a31432.tar.xz |
if end id is missing assign IP address to raw public key
Diffstat (limited to 'src/starter/starterwhack.c')
-rw-r--r-- | src/starter/starterwhack.c | 14 |
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; } |