aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto/keys.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2007-08-06 11:05:11 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2007-08-06 11:05:11 +0000
commitafc51a247fb01025e3d29d486acd8f4acbea02c3 (patch)
treefcc55d61d829db53490e9a3c0bd134c7a281c729 /src/pluto/keys.c
parent9ec19f13f73de2e90f746396524f7d05c34b9d7e (diff)
downloadstrongswan-afc51a247fb01025e3d29d486acd8f4acbea02c3.tar.bz2
strongswan-afc51a247fb01025e3d29d486acd8f4acbea02c3.tar.xz
debug info on preshared secrets
Diffstat (limited to 'src/pluto/keys.c')
-rw-r--r--src/pluto/keys.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/pluto/keys.c b/src/pluto/keys.c
index 1efe85228..2113f13a8 100644
--- a/src/pluto/keys.c
+++ b/src/pluto/keys.c
@@ -772,6 +772,34 @@ process_pin(secret_t *s, int whackfd)
}
static void
+log_psk(secret_t *s)
+{
+ int n = 0;
+ char buf[BUF_LEN];
+ id_list_t *id_list = s->ids;
+
+ if (id_list == NULL)
+ {
+ n = snprintf(buf, BUF_LEN, "%%any");
+ }
+ else
+ {
+ do
+ {
+ n += idtoa(&id_list->id, buf + n, BUF_LEN - n);
+ if (n >= BUF_LEN)
+ {
+ n = BUF_LEN - 1;
+ break;
+ }
+ id_list = id_list->next;
+ }
+ while (id_list);
+ }
+ plog(" loaded shared key for %.*s", n, buf);
+}
+
+static void
process_secret(secret_t *s, int whackfd)
{
err_t ugh = NULL;
@@ -780,11 +808,13 @@ process_secret(secret_t *s, int whackfd)
if (*tok == '"' || *tok == '\'')
{
/* old PSK format: just a string */
+ log_psk(s);
ugh = process_psk_secret(&s->u.preshared_secret);
}
else if (tokeqword("psk"))
{
/* preshared key: quoted string or ttodata format */
+ log_psk(s);
ugh = !shift()? "unexpected end of record in PSK"
: process_psk_secret(&s->u.preshared_secret);
}