pluto: Fix for null-terminated XAuth secrets (as sent by Android 4).
authorTobias Brunner <tobias@strongswan.org>
Tue, 24 Apr 2012 07:25:38 +0000 (09:25 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 24 Apr 2012 07:25:38 +0000 (09:25 +0200)
src/pluto/plugins/xauth/xauth_default_verifier.c

index 776f771..ca2e36a 100644 (file)
@@ -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;