diff options
author | Martin Willi <martin@revosec.ch> | 2012-03-22 15:01:35 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-22 15:09:25 +0100 |
commit | 3110744a6baff7a4a061d0264e329cfe4b170431 (patch) | |
tree | 1ff321e83ba51c2cd3d4ebcf26bee3372a604f56 /src | |
parent | 83d77866f476ed0968283a8a8f349c48d92a1158 (diff) | |
download | strongswan-3110744a6baff7a4a061d0264e329cfe4b170431.tar.bz2 strongswan-3110744a6baff7a4a061d0264e329cfe4b170431.tar.xz |
Fix null-terminated XAuth passwords, as sent by Android 4
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/xauth_eap/xauth_eap.c | 4 | ||||
-rw-r--r-- | src/libcharon/plugins/xauth_generic/xauth_generic.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libcharon/plugins/xauth_eap/xauth_eap.c b/src/libcharon/plugins/xauth_eap/xauth_eap.c index e59084344..7ccb80205 100644 --- a/src/libcharon/plugins/xauth_eap/xauth_eap.c +++ b/src/libcharon/plugins/xauth_eap/xauth_eap.c @@ -217,6 +217,10 @@ METHOD(xauth_method_t, process, status_t, this->peer->destroy(this->peer); this->peer = id; } + if (pass.len && pass.ptr[pass.len - 1] == 0) + { /* fix null-terminated passwords (Android etc.) */ + pass.len -= 1; + } name = lib->settings->get_str(lib->settings, "charon.plugins.xauth-eap.backend", "radius"); diff --git a/src/libcharon/plugins/xauth_generic/xauth_generic.c b/src/libcharon/plugins/xauth_generic/xauth_generic.c index 907de4322..f0e675ac0 100644 --- a/src/libcharon/plugins/xauth_generic/xauth_generic.c +++ b/src/libcharon/plugins/xauth_generic/xauth_generic.c @@ -136,6 +136,10 @@ METHOD(xauth_method_t, process_server, status_t, this->peer->destroy(this->peer); this->peer = id; } + if (pass.len && pass.ptr[pass.len - 1] == 0) + { /* fix null-terminated passwords (Android etc.) */ + pass.len -= 1; + } enumerator = lib->credmgr->create_shared_enumerator(lib->credmgr, SHARED_EAP, this->server, this->peer); |