forked from enlightenment/efl
ecore_con: add test cases related to SSL.
Summary: Add test cases related to SSL. Now it is not crashing and all test cases passes. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2095 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
6721800e7b
commit
5b27425782
|
@ -176,9 +176,9 @@ _dns_err(void *data, int type EINA_UNUSED, void *ev EINA_UNUSED)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
|
void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name, Eina_Bool is_ssl)
|
||||||
{
|
{
|
||||||
Ecore_Con_Server *server = NULL;
|
Ecore_Con_Server *server;
|
||||||
Ecore_Con_Server *client;
|
Ecore_Con_Server *client;
|
||||||
Ecore_Con_Client *cl;
|
Ecore_Con_Client *cl;
|
||||||
const Eina_List *clients, *l;
|
const Eina_List *clients, *l;
|
||||||
|
@ -220,6 +220,12 @@ void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
|
||||||
server_data);
|
server_data);
|
||||||
fail_if (server == NULL);
|
fail_if (server == NULL);
|
||||||
|
|
||||||
|
if (is_ssl)
|
||||||
|
{
|
||||||
|
fail_unless(ecore_con_ssl_server_cert_add(server, TESTS_SRC_DIR"/server.pem"));
|
||||||
|
fail_unless(ecore_con_ssl_server_privkey_add(server, TESTS_SRC_DIR"/server.key"));
|
||||||
|
}
|
||||||
|
|
||||||
del_ret = ecore_con_server_data_get(server);
|
del_ret = ecore_con_server_data_get(server);
|
||||||
fail_if (del_ret != server_data);
|
fail_if (del_ret != server_data);
|
||||||
|
|
||||||
|
@ -241,6 +247,12 @@ void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
|
||||||
client_data);
|
client_data);
|
||||||
fail_if (client == NULL);
|
fail_if (client == NULL);
|
||||||
|
|
||||||
|
if (is_ssl)
|
||||||
|
{
|
||||||
|
fail_unless(ecore_con_ssl_server_cafile_add(server, TESTS_SRC_DIR"/server.pem"));
|
||||||
|
ecore_con_ssl_server_verify(server);
|
||||||
|
}
|
||||||
|
|
||||||
ecore_main_loop_begin();
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
clients = ecore_con_server_clients_get(server);
|
clients = ecore_con_server_clients_get(server);
|
||||||
|
@ -285,31 +297,103 @@ void _ecore_con_server_client_tests(Ecore_Con_Type compl_type, const char *name)
|
||||||
|
|
||||||
START_TEST(ecore_test_ecore_con_local_user)
|
START_TEST(ecore_test_ecore_con_local_user)
|
||||||
{
|
{
|
||||||
_ecore_con_server_client_tests(ECORE_CON_LOCAL_USER, "test_sock");
|
_ecore_con_server_client_tests(ECORE_CON_LOCAL_USER, "test_sock", EINA_FALSE);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(ecore_test_ecore_con_local_system)
|
START_TEST(ecore_test_ecore_con_local_system)
|
||||||
{
|
{
|
||||||
_ecore_con_server_client_tests(ECORE_CON_LOCAL_SYSTEM, "test_sock");
|
_ecore_con_server_client_tests(ECORE_CON_LOCAL_SYSTEM, "test_sock", EINA_FALSE);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(ecore_test_ecore_con_local_abstract)
|
START_TEST(ecore_test_ecore_con_local_abstract)
|
||||||
{
|
{
|
||||||
_ecore_con_server_client_tests(ECORE_CON_LOCAL_ABSTRACT, "test_sock");
|
_ecore_con_server_client_tests(ECORE_CON_LOCAL_ABSTRACT, "test_sock", EINA_FALSE);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(ecore_test_ecore_con_remote_tcp)
|
START_TEST(ecore_test_ecore_con_remote_tcp)
|
||||||
{
|
{
|
||||||
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP, "127.0.0.1");
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP, "127.0.0.1", EINA_FALSE);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(ecore_test_ecore_con_remote_nodelay)
|
START_TEST(ecore_test_ecore_con_remote_nodelay)
|
||||||
{
|
{
|
||||||
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY, "127.0.0.1");
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY, "127.0.0.1", EINA_FALSE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_ssl3)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_SSL3, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_ssl3_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_tls)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_tls_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_mixed)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_tcp_mixed_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_ssl3)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_SSL3, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_ssl3_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_tls)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_TLS, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_tls_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_mixed)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_MIXED, "127.0.0.1", EINA_TRUE);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(ecore_test_ecore_con_remote_nodelay_mixed_load_cert)
|
||||||
|
{
|
||||||
|
_ecore_con_server_client_tests(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT, "127.0.0.1", EINA_TRUE);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
@ -381,7 +465,19 @@ void ecore_test_ecore_con(TCase *tc)
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_local_system);
|
tcase_add_test(tc, ecore_test_ecore_con_local_system);
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_local_abstract);
|
tcase_add_test(tc, ecore_test_ecore_con_local_abstract);
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp);
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_ssl3);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_ssl3_load_cert);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_tls);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_tls_load_cert);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_mixed);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_tcp_mixed_load_cert);
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay);
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_ssl3);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_ssl3_load_cert);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_tls);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_tls_load_cert);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_mixed);
|
||||||
|
tcase_add_test(tc, ecore_test_ecore_con_remote_nodelay_mixed_load_cert);
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_dns);
|
tcase_add_test(tc, ecore_test_ecore_con_dns);
|
||||||
tcase_add_test(tc, ecore_test_ecore_con_shutdown_bef_init);
|
tcase_add_test(tc, ecore_test_ecore_con_shutdown_bef_init);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIICXAIBAAKBgQDPM7htA+kHL37qJQOLK3CYP4x9mqCcYy4m4GvT+yn5b4IRqi1x
|
||||||
|
iH0F+/A+hvG4EE/iamNsnM7uJ1bixw/BCya+m9EfE5qzQvZuU+6AN73D+nMXcgBd
|
||||||
|
4TTjfF8MD340a1Tn3RRVOx1hdSuuN61wpIFT/sn/dfTaVzD/UnMWj+AdBQIDAQAB
|
||||||
|
AoGAYc6wSAWIgnPRHQXL3m3rAHM/BitvlWLb7k4RmEb/UVdptpz2Rpl/Ksv6ZAmf
|
||||||
|
IJvSmbZOqH58z76SLQp6TU3OQ2IBikHo8+C+RgPWptBDlgYO57zGz4ee28tImqV/
|
||||||
|
quxNE+TM9EBJDAhGA0ySaiQcdfOOErzRQvcFSTE2ie9LjAECQQDvUmMzsYhEEb8B
|
||||||
|
RS7ASYNUFihBPprZh+/qhJeF37kK7t1g2zk5gwfEo2W9926DiKicpvX1/hxgKOwb
|
||||||
|
ZpZuhRAhAkEA3aRNBnrDPo+gaP+wV4Z410+laW/myqbEN9l6tcGQqRZmOXw6jEAm
|
||||||
|
Cq5zngIVibaVZ4g052c4PHl51txYoEjAZQJBAM4He2exWsJfFLSfPpRDtU/ak2U3
|
||||||
|
5E+Je73F0DxsUf1bjjIoCKe+ah2bHafhL78FE0NpaS4RSZRvJnSgaLlUzIECQB5H
|
||||||
|
SMJ+2NdeFaLiczuxwiZf2hAKWnQKzjl2+12DIPkId1SZFQJ97PR+morWbAzRJZ3s
|
||||||
|
LJYEMtmIGs3wcicLaUUCQFBmyP238jX58ixYd7crJdnxPnTvOtasQqb8cPJ9XSyT
|
||||||
|
ara6m96iiQSvqXObtmRl6oGCWGw8q821iJYHKFD0ls4=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
|
@ -0,0 +1,14 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICOTCCAaICCQDQ5umIhrgBUDANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJJ
|
||||||
|
TjEMMAoGA1UECAwDS2FyMRIwEAYDVQQHDAlCZW5nYWx1cnUxDDAKBgNVBAoMA0VG
|
||||||
|
TDEOMAwGA1UECwwFRWNvcmUxEjAQBgNVBAMMCTEyNy4wLjAuMTAeFw0xNTAyMTIw
|
||||||
|
NDIxMDVaFw0xNjAyMTIwNDIxMDVaMGExCzAJBgNVBAYTAklOMQwwCgYDVQQIDANL
|
||||||
|
YXIxEjAQBgNVBAcMCUJlbmdhbHVydTEMMAoGA1UECgwDRUZMMQ4wDAYDVQQLDAVF
|
||||||
|
Y29yZTESMBAGA1UEAwwJMTI3LjAuMC4xMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
|
||||||
|
iQKBgQDPM7htA+kHL37qJQOLK3CYP4x9mqCcYy4m4GvT+yn5b4IRqi1xiH0F+/A+
|
||||||
|
hvG4EE/iamNsnM7uJ1bixw/BCya+m9EfE5qzQvZuU+6AN73D+nMXcgBd4TTjfF8M
|
||||||
|
D340a1Tn3RRVOx1hdSuuN61wpIFT/sn/dfTaVzD/UnMWj+AdBQIDAQABMA0GCSqG
|
||||||
|
SIb3DQEBCwUAA4GBALgUu21Ihj6W2/tagmV7Iwt4LJndnIJP1IINUrLptkH1vE4B
|
||||||
|
4p7uHxtRp7fQpOOl2ns1JhJabgHUjXLCPfjsZ1YS5YgTqs9IaiyqjYZDgCusSvrJ
|
||||||
|
eJXeNVLWMb6iHgW0zsEDv9Vl1/XyBk9koyP0/stWw+JFxKqMJGCen5dRPQLZ
|
||||||
|
-----END CERTIFICATE-----
|
Loading…
Reference in New Issue