diff options
-rw-r--r-- | src/charon/Makefile.am | 2 | ||||
-rw-r--r-- | src/charon/testing/Makefile.am | 7 | ||||
-rw-r--r-- | src/charon/testing/identification_test.c | 31 | ||||
-rw-r--r-- | src/charon/testing/kernel_interface_test.c | 12 |
4 files changed, 27 insertions, 25 deletions
diff --git a/src/charon/Makefile.am b/src/charon/Makefile.am index c2f35839f..b22c12ebf 100644 --- a/src/charon/Makefile.am +++ b/src/charon/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = . testing + ipsec_PROGRAMS = charon charon_SOURCES = \ diff --git a/src/charon/testing/Makefile.am b/src/charon/testing/Makefile.am index 0397a37e2..9f3b26085 100644 --- a/src/charon/testing/Makefile.am +++ b/src/charon/testing/Makefile.am @@ -17,10 +17,9 @@ rsa_test.h generator_test.h aes_cbc_crypter_test.h send_queue_test.c testing_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lgmp -lpthread -lm \ $(top_srcdir)/src/charon/connection.o $(top_srcdir)/src/charon/local_connection_store.o $(top_srcdir)/src/charon/policy.o \ $(top_srcdir)/src/charon/local_policy_store.o $(top_srcdir)/src/charon/local_credential_store.o $(top_srcdir)/src/charon/traffic_selector.o \ -$(top_srcdir)/src/charon/proposal.o $(top_srcdir)/src/charon/configuration.o $(top_srcdir)/src/charon/state.o $(top_srcdir)/src/charon/ike_sa_init_requested.o \ -$(top_srcdir)/src/charon/ike_sa_init_responded.o $(top_srcdir)/src/charon/ike_sa_established.o $(top_srcdir)/src/charon/responder_init.o \ -$(top_srcdir)/src/charon/initiator_init.o $(top_srcdir)/src/charon/ike_auth_requested.o $(top_srcdir)/src/charon/delete_ike_sa_requested.o \ -$(top_srcdir)/src/charon/delete_child_sa_requested.o $(top_srcdir)/src/charon/create_child_sa_requested.o \ +$(top_srcdir)/src/charon/proposal.o $(top_srcdir)/src/charon/configuration.o $(top_srcdir)/src/charon/transaction.o \ +$(top_srcdir)/src/charon/ike_sa_init.o $(top_srcdir)/src/charon/ike_auth.o $(top_srcdir)/src/charon/create_child_sa.o \ +$(top_srcdir)/src/charon/delete_child_sa.o $(top_srcdir)/src/charon/delete_ike_sa.o $(top_srcdir)/src/charon/dead_peer_detection.o \ $(top_srcdir)/src/charon/child_sa.o $(top_srcdir)/src/charon/ike_sa.o $(top_srcdir)/src/charon/ike_sa_manager.o $(top_srcdir)/src/charon/ike_sa_id.o \ $(top_srcdir)/src/charon/authenticator.o $(top_srcdir)/src/charon/encryption_payload.o $(top_srcdir)/src/charon/cert_payload.o \ $(top_srcdir)/src/charon/traffic_selector_substructure.o $(top_srcdir)/src/charon/transform_attribute.o $(top_srcdir)/src/charon/configuration_attribute.o \ diff --git a/src/charon/testing/identification_test.c b/src/charon/testing/identification_test.c index b148b53e0..c821bcc48 100644 --- a/src/charon/testing/identification_test.c +++ b/src/charon/testing/identification_test.c @@ -34,6 +34,7 @@ void test_identification(protected_tester_t *tester) { identification_t *a, *b, *c, *d; bool result; + int wildcards; { /* test RFC822_ADDR */ char *bob_string = "bob@wonderland.net"; @@ -44,17 +45,17 @@ void test_identification(protected_tester_t *tester) c = identification_create_from_string("*@wonderland.net"); d = identification_create_from_string("*@badlands.com"); - result = a->belongs_to(a, c); + result = a->matches(a, c, &wildcards); tester->assert_true(tester, result, "alice belongs to wonderland"); - result = b->belongs_to(b, c); + result = b->matches(b, c, &wildcards); tester->assert_true(tester, result, "bob belongs to wonderland"); - result = a->belongs_to(a, d); + result = a->matches(a, d, &wildcards); tester->assert_false(tester, result, "alice does not belong to badlands"); - result = b->belongs_to(b, d); + result = b->matches(b, d, &wildcards); tester->assert_false(tester, result, "bob does not belong to badlands"); - result = c->belongs_to(c, d); + result = c->matches(c, d, &wildcards); tester->assert_false(tester, result, "wonderland is not in badlands"); - result = a->belongs_to(a, a); + result = a->matches(a, a, &wildcards); tester->assert_true(tester, result, "alice belongs to alice alice"); result = a->equals(a, a); tester->assert_true(tester, result, "alice is alice"); @@ -76,17 +77,17 @@ void test_identification(protected_tester_t *tester) c = identification_create_from_string("@*.nirvana.org"); d = identification_create_from_string("@*.samsara.com"); - result = a->belongs_to(a, c); + result = a->matches(a, c, &wildcards); tester->assert_true(tester, result, "carol belongs to nirvana"); - result = b->belongs_to(b, c); + result = b->matches(b, c, &wildcards); tester->assert_true(tester, result, "dave belongs to nirvana"); - result = a->belongs_to(a, d); + result = a->matches(a, d, &wildcards); tester->assert_false(tester, result, "carol does not belong to samsara"); - result = b->belongs_to(b, d); + result = b->matches(b, d, &wildcards); tester->assert_false(tester, result, "dave does not belong to samsara"); - result = c->belongs_to(c, d); + result = c->matches(c, d, &wildcards); tester->assert_false(tester, result, "nirvana is not in samsara"); - result = a->belongs_to(a, a); + result = a->matches(a, a, &wildcards); tester->assert_true(tester, result, "carol belongs to carol carol"); result = a->equals(a, a); tester->assert_true(tester, result, "carol is carol"); @@ -150,12 +151,12 @@ void test_identification(protected_tester_t *tester) tester->assert_true(tester, result, "DN of alice equals DN of alice"); result = a->equals(a, b); tester->assert_false(tester, result, "DN of alice doesn't equal DN of bob"); - result = a->belongs_to(a, c); + result = a->matches(a, c, &wildcards); tester->assert_true(tester, result, "DN of alice belongs to DN of carol"); /* TODO: This does NOT work, wildcard check should work with unordered RDNs */ - result = b->belongs_to(b, c); + result = b->matches(b, c, &wildcards); tester->assert_true(tester, result, "DN of bob belongs to DN of carol"); - result = b->belongs_to(b, d); + result = b->matches(b, d, &wildcards); tester->assert_false(tester, result, "DN of bob doesn't belong to DN of dave"); a->destroy(a); diff --git a/src/charon/testing/kernel_interface_test.c b/src/charon/testing/kernel_interface_test.c index 57a9e8dd8..c151ec50c 100644 --- a/src/charon/testing/kernel_interface_test.c +++ b/src/charon/testing/kernel_interface_test.c @@ -69,10 +69,10 @@ left = host_create(AF_INET, "10.1.0.0", 0); right = host_create(AF_INET, "10.2.0.0", 0); - status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0, PROTO_ESP, 1234); + status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0, PROTO_ESP, 1234, FALSE); tester->assert_true(tester, status == SUCCESS, "add policy"); - status = kernel_interface->del_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0); + status = kernel_interface->del_policy(kernel_interface, left, right, 16, 16, XFRM_POLICY_OUT, 0); tester->assert_true(tester, status == SUCCESS, "del policy"); status = kernel_interface->del_sa(kernel_interface, other, spi, PROTO_ESP); @@ -144,11 +144,11 @@ void test_kernel_interface_update_hosts(protected_tester_t *tester) left = host_create(AF_INET, "10.1.0.0", 0); right = host_create(AF_INET, "10.2.0.0", 0); - status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0, PROTO_ESP, 1234); + status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0, PROTO_ESP, 1234, FALSE); tester->assert_true(tester, status == SUCCESS, "add policy OUT"); - status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_IN, 0, PROTO_ESP, 1234); + status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_IN, 0, PROTO_ESP, 1234, FALSE); tester->assert_true(tester, status == SUCCESS, "add policy IN"); - status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_FWD, 0, PROTO_ESP, 1234); + status = kernel_interface->add_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_FWD, 0, PROTO_ESP, 1234, FALSE); tester->assert_true(tester, status == SUCCESS, "add policy FWD"); new_me = host_create(AF_INET, "192.168.1.12", 4500); @@ -157,7 +157,7 @@ void test_kernel_interface_update_hosts(protected_tester_t *tester) status = kernel_interface->update_sa_hosts(kernel_interface, me, other, new_me, new_other, me->get_differences(me, new_me), other->get_differences(other, new_other), spi, PROTO_ESP); tester->assert_true(tester, status == SUCCESS, "update hosts on sa"); - status = kernel_interface->del_policy(kernel_interface, me, other, left, right, 16, 16, XFRM_POLICY_OUT, 0); + status = kernel_interface->del_policy(kernel_interface, left, right, 16, 16, XFRM_POLICY_OUT, 0); tester->assert_true(tester, status == SUCCESS, "del policy"); status = kernel_interface->del_sa(kernel_interface, other, spi, PROTO_ESP); |