diff options
author | Martin Willi <martin@revosec.ch> | 2012-01-19 16:22:25 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:37 +0100 |
commit | 47b8f6ef4b3637e94d4b211721b38ba263f6d9c0 (patch) | |
tree | 71614d59135d8d7d09d742c207183502170b2909 /src/conftest/hooks/rebuild_auth.c | |
parent | ae92641806c1b45d266487590f13f622c0478d1d (diff) | |
download | strongswan-47b8f6ef4b3637e94d4b211721b38ba263f6d9c0.tar.bz2 strongswan-47b8f6ef4b3637e94d4b211721b38ba263f6d9c0.tar.xz |
Invoke bus_t.message hook twice, once plain and parsed, once encoded and encrypted
Diffstat (limited to 'src/conftest/hooks/rebuild_auth.c')
-rw-r--r-- | src/conftest/hooks/rebuild_auth.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/conftest/hooks/rebuild_auth.c b/src/conftest/hooks/rebuild_auth.c index 1197eb2dc..8ee4e14b1 100644 --- a/src/conftest/hooks/rebuild_auth.c +++ b/src/conftest/hooks/rebuild_auth.c @@ -175,34 +175,37 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa, METHOD(listener_t, message, bool, private_rebuild_auth_t *this, ike_sa_t *ike_sa, message_t *message, - bool incoming) + bool incoming, bool plain) { - if (!incoming && message->get_message_id(message) == 1) + if (plain) { - rebuild_auth(this, ike_sa, message); - } - if (message->get_exchange_type(message) == IKE_SA_INIT) - { - if (incoming) + if (!incoming && message->get_message_id(message) == 1) { - nonce_payload_t *nonce; - - nonce = (nonce_payload_t*)message->get_payload(message, NONCE); - if (nonce) - { - free(this->nonce.ptr); - this->nonce = nonce->get_nonce(nonce); - } + rebuild_auth(this, ike_sa, message); } - else + if (message->get_exchange_type(message) == IKE_SA_INIT) { - packet_t *packet; - - if (message->generate(message, NULL, &packet) == SUCCESS) + if (incoming) + { + nonce_payload_t *nonce; + + nonce = (nonce_payload_t*)message->get_payload(message, NONCE); + if (nonce) + { + free(this->nonce.ptr); + this->nonce = nonce->get_nonce(nonce); + } + } + else { - free(this->ike_init.ptr); - this->ike_init = chunk_clone(packet->get_data(packet)); - packet->destroy(packet); + packet_t *packet; + + if (message->generate(message, NULL, &packet) == SUCCESS) + { + free(this->ike_init.ptr); + this->ike_init = chunk_clone(packet->get_data(packet)); + packet->destroy(packet); + } } } } |