diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 01:47:30 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 17:02:32 +0200 |
commit | 0782fc43f809b1c2a5001453ccb064a4afcfc2b9 (patch) | |
tree | 8eb9d299dbafc3e44f5e2251cc464b622319cbba /tests/online | |
parent | 0fef38999abc74b8237971f96295f461631d9d1d (diff) | |
download | libgit2-0782fc43f809b1c2a5001453ccb064a4afcfc2b9.tar.gz |
net: use only structs to pass information about cert
Instead of spreading the data in function arguments, some of which
aren't used for ssh and having a struct only for ssh, use a struct for
both, using a common parent to pass to the callback.
Diffstat (limited to 'tests/online')
-rw-r--r-- | tests/online/clone.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c index f88a4d611..2c36b3d22 100644 --- a/tests/online/clone.c +++ b/tests/online/clone.c @@ -473,13 +473,12 @@ void test_online_clone__ssh_cannot_change_username(void) cl_git_fail(git_clone(&g_repo, "ssh://git@github.com/libgit2/TestGitRepository", "./foo", &g_options)); } -int ssh_certificate_check(git_cert_t type, void *data, size_t len, int valid, void *payload) +int ssh_certificate_check(git_cert *cert, int valid, void *payload) { git_cert_hostkey *key; git_oid expected = {{0}}, actual = {{0}}; const char *expected_str; - GIT_UNUSED(len); GIT_UNUSED(valid); GIT_UNUSED(payload); @@ -487,10 +486,10 @@ int ssh_certificate_check(git_cert_t type, void *data, size_t len, int valid, vo if (!expected_str) cl_skip(); - cl_git_pass(git_oid_fromstr(&expected, expected_str)); - cl_assert_equal_i(GIT_CERT_HOSTKEY_LIBSSH2, type); + cl_git_pass(git_oid_fromstrp(&expected, expected_str)); + cl_assert_equal_i(GIT_CERT_HOSTKEY_LIBSSH2, cert->cert_type); - key = (git_cert_hostkey *) data; + key = (git_cert_hostkey *) cert; git_oid_fromraw(&actual, key->hash); cl_assert(git_oid_equal(&expected, &actual)); @@ -511,11 +510,9 @@ void test_online_clone__url_with_no_path_returns_EINVALIDSPEC(void) GIT_EINVALIDSPEC); } -static int fail_certificate_check(git_cert_t type, void *data, size_t len, int valid, void *payload) +static int fail_certificate_check(git_cert *cert, int valid, void *payload) { - GIT_UNUSED(type); - GIT_UNUSED(data); - GIT_UNUSED(len); + GIT_UNUSED(cert); GIT_UNUSED(valid); GIT_UNUSED(payload); @@ -535,11 +532,9 @@ void test_online_clone__certificate_invalid(void) #endif } -static int succeed_certificate_check(git_cert_t type, void *data, size_t len, int valid, void *payload) +static int succeed_certificate_check(git_cert *cert, int valid, void *payload) { - GIT_UNUSED(type); - GIT_UNUSED(data); - GIT_UNUSED(len); + GIT_UNUSED(cert); GIT_UNUSED(valid); GIT_UNUSED(payload); |