mirror of
https://github.com/strongswan/strongswan.git
synced 2025-11-27 00:00:29 -05:00
if end id is missing assign IP address to raw public key
This commit is contained in:
parent
a07531250e
commit
ee2679ec25
@ -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,19 +243,24 @@ 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
|
||||
{
|
||||
addrtot(&end->addr, 0, buf, sizeof(buf));
|
||||
msg.keyid = buf;
|
||||
}
|
||||
msg.keyval.ptr = keyspace;
|
||||
return send_whack_msg(&msg);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user