diff options
author | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2007-10-26 14:10:02 +0000 |
---|---|---|
committer | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2007-10-26 14:10:02 +0000 |
commit | 49104abddf3d71d5abf5cf75dc7f95fa6c55fa63 (patch) | |
tree | 28f7a72e5dec4abf908fd7874bdab776281310bc /src/pluto/keys.c | |
parent | 7b0305f59ddab9ea026b202a8c569912e5bf9a90 (diff) | |
download | vyos-strongswan-49104abddf3d71d5abf5cf75dc7f95fa6c55fa63.tar.gz vyos-strongswan-49104abddf3d71d5abf5cf75dc7f95fa6c55fa63.zip |
[svn-upgrade] Integrating new upstream version, strongswan (4.1.8)
Diffstat (limited to 'src/pluto/keys.c')
-rw-r--r-- | src/pluto/keys.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/pluto/keys.c b/src/pluto/keys.c index 1efe85228..eab9dfc4a 100644 --- a/src/pluto/keys.c +++ b/src/pluto/keys.c @@ -11,7 +11,7 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * - * RCSID $Id: keys.c,v 1.24 2006/01/27 08:59:40 as Exp $ + * RCSID $Id: keys.c 3252 2007-10-06 21:24:50Z andreas $ */ #include <stddef.h> @@ -772,6 +772,38 @@ 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; + } + else if (n < BUF_LEN - 1) + { + n += snprintf(buf + n, BUF_LEN - n, " "); + } + 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 +812,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); } |