diff options
author | Martin Willi <martin@revosec.ch> | 2011-11-23 11:26:04 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:30:49 +0100 |
commit | 017d98bf39e3824829cf17be1723b460a2ddeb4e (patch) | |
tree | ec0187ea36553eb0f11942de6e179a53fd5753e7 /src/libcharon/sa/tasks/xauth_request.c | |
parent | df99e976be113cb55d7d38061e546bc8f0377c95 (diff) | |
download | strongswan-017d98bf39e3824829cf17be1723b460a2ddeb4e.tar.bz2 strongswan-017d98bf39e3824829cf17be1723b460a2ddeb4e.tar.xz |
Merged IKEv1 attribute payload/data into configuration payload/attribute
Diffstat (limited to 'src/libcharon/sa/tasks/xauth_request.c')
-rw-r--r-- | src/libcharon/sa/tasks/xauth_request.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/libcharon/sa/tasks/xauth_request.c b/src/libcharon/sa/tasks/xauth_request.c index a50d0fb43..60914beef 100644 --- a/src/libcharon/sa/tasks/xauth_request.c +++ b/src/libcharon/sa/tasks/xauth_request.c @@ -3,8 +3,7 @@ #include <daemon.h> #include <hydra.h> -#include <encoding/payloads/attribute_payload_v1.h> -#include <encoding/payloads/data_attribute_v1.h> +#include <encoding/payloads/cp_payload.h> #include <encoding/payloads/hash_payload.h> #include <encoding/generator.h> @@ -61,10 +60,9 @@ static void process_payloads(private_xauth_request_t *this, message_t *message) METHOD(task_t, build_i, status_t, private_xauth_request_t *this, message_t *message) { - attribute_payload_v1_t *ap = NULL; + cp_payload_t *cp; chunk_t chunk = chunk_empty; - data_attribute_v1_t *da = NULL; - hash_payload_t *hash_payload = NULL; + hash_payload_t *hash_payload; generator_t *generator; chunk_t attr_chunk; chunk_t mid_chunk; @@ -76,13 +74,11 @@ METHOD(task_t, build_i, status_t, DBG1(DBG_IKE, "BUILDING XAUTH REQUEST PACKET"); /* TODO1: Create ATTR payload */ - ap = attribute_payload_v1_create(); - - da = data_attribute_v1_create_value(XAUTH_USER_NAME, chunk); - ap->add_attribute(ap, da); - - da = data_attribute_v1_create_value(XAUTH_USER_PASSWORD, chunk); - ap->add_attribute(ap, da); + cp = cp_payload_create(CONFIGURATION_V1); + cp->add_attribute(cp, configuration_attribute_create_chunk( + CONFIGURATION_ATTRIBUTE_V1, XAUTH_USER_NAME, chunk)); + cp->add_attribute(cp, configuration_attribute_create_chunk( + CONFIGURATION_ATTRIBUTE_V1, XAUTH_USER_PASSWORD, chunk)); /* Create HASH payload */ hash_payload = hash_payload_create(); @@ -90,8 +86,8 @@ METHOD(task_t, build_i, status_t, /* Calculate the chunk for the ATTR payload */ generator = generator_create(); - ap->payload_interface.set_next_type(&ap->payload_interface, NO_PAYLOAD); - generator->generate_payload(generator, (payload_t *)ap); + cp->payload_interface.set_next_type(&cp->payload_interface, NO_PAYLOAD); + generator->generate_payload(generator, (payload_t *)cp); attr_chunk = generator->get_chunk(generator, &lenpos); /* Get the message ID in network order */ @@ -102,7 +98,7 @@ METHOD(task_t, build_i, status_t, hash_in = chunk_cat("cc", mid_chunk, attr_chunk); message->add_payload(message, (payload_t *)hash_payload); - message->add_payload(message, (payload_t *)ap); + message->add_payload(message, (payload_t *)cp); return NEED_MORE; } |