summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/xauth_pam/xauth_pam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/plugins/xauth_pam/xauth_pam.c')
-rw-r--r--src/libcharon/plugins/xauth_pam/xauth_pam.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libcharon/plugins/xauth_pam/xauth_pam.c b/src/libcharon/plugins/xauth_pam/xauth_pam.c
index 71c79ecc0..3414d2ec8 100644
--- a/src/libcharon/plugins/xauth_pam/xauth_pam.c
+++ b/src/libcharon/plugins/xauth_pam/xauth_pam.c
@@ -43,11 +43,11 @@ METHOD(xauth_method_t, initiate, status_t,
{
cp_payload_t *cp;
- cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REQUEST);
+ cp = cp_payload_create_type(PLV1_CONFIGURATION, CFG_REQUEST);
cp->add_attribute(cp, configuration_attribute_create_chunk(
- CONFIGURATION_ATTRIBUTE_V1, XAUTH_USER_NAME, chunk_empty));
+ PLV1_CONFIGURATION_ATTRIBUTE, XAUTH_USER_NAME, chunk_empty));
cp->add_attribute(cp, configuration_attribute_create_chunk(
- CONFIGURATION_ATTRIBUTE_V1, XAUTH_USER_PASSWORD, chunk_empty));
+ PLV1_CONFIGURATION_ATTRIBUTE, XAUTH_USER_PASSWORD, chunk_empty));
*out = cp;
return NEED_MORE;
}
@@ -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;