diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-07-07 11:12:30 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-07-07 11:14:02 +0200 |
commit | 44870e531309de01bf1eb92976d5046ab6526fb0 (patch) | |
tree | bc3569fb1ba41930891c5b8f09435c433cac288a /src | |
parent | 839951097ca3cb6e9bddddf0dffa2039369a9074 (diff) | |
download | strongswan-44870e531309de01bf1eb92976d5046ab6526fb0.tar.bz2 strongswan-44870e531309de01bf1eb92976d5046ab6526fb0.tar.xz |
xauth-pam: Add workaround for null-terminated passwords
Fixes #631.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/xauth_pam/xauth_pam.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcharon/plugins/xauth_pam/xauth_pam.c b/src/libcharon/plugins/xauth_pam/xauth_pam.c index 1970146c0..3414d2ec8 100644 --- a/src/libcharon/plugins/xauth_pam/xauth_pam.c +++ b/src/libcharon/plugins/xauth_pam/xauth_pam.c @@ -153,7 +153,12 @@ METHOD(xauth_method_t, process, status_t, attr2string(user, sizeof(user), chunk); break; case XAUTH_USER_PASSWORD: - attr2string(pass, sizeof(pass), attr->get_chunk(attr)); + chunk = attr->get_chunk(attr); + if (chunk.len && chunk.ptr[chunk.len - 1] == 0) + { /* fix null-terminated passwords (Android etc.) */ + chunk.len -= 1; + } + attr2string(pass, sizeof(pass), chunk); break; default: break; |