diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-04-24 09:25:38 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-04-24 09:25:38 +0200 |
commit | 7d85bebc49d11f9d80de6e813147385d73399005 (patch) | |
tree | ba0b4af20d8fe95df938c7b0fa6eaa1881add7db | |
parent | 5ff8fe5d481f9463c4ba637bd0f16b1d36048a3a (diff) | |
download | strongswan-7d85bebc49d11f9d80de6e813147385d73399005.tar.bz2 strongswan-7d85bebc49d11f9d80de6e813147385d73399005.tar.xz |
pluto: Fix for null-terminated XAuth secrets (as sent by Android 4).
-rw-r--r-- | src/pluto/plugins/xauth/xauth_default_verifier.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pluto/plugins/xauth/xauth_default_verifier.c b/src/pluto/plugins/xauth/xauth_default_verifier.c index 776f77134..ca2e36aa0 100644 --- a/src/pluto/plugins/xauth/xauth_default_verifier.c +++ b/src/pluto/plugins/xauth/xauth_default_verifier.c @@ -43,6 +43,13 @@ METHOD(xauth_verifier_t, verify_secret, bool, if (get_xauth_secret(user, server, &xauth_secret)) { success = chunk_equals(secret, xauth_secret); + + if (!success && secret.len && secret.ptr[secret.len - 1] == 0) + { /* fix for null-terminated passwords (e.g. from Android 4) */ + secret.len--; + success = chunk_equals(secret, xauth_secret); + } + chunk_clear(&xauth_secret); } return success; |