diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-08-29 17:18:23 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 17:01:30 +0200 |
commit | 17491f6e5660b82cb8163eea58805df6398af16e (patch) | |
tree | 406aaf1fc53853465fb84452d3c8bb45945694fe /tests/online | |
parent | 85acc56262b20567c40a90c0996115060655112c (diff) | |
download | libgit2-17491f6e5660b82cb8163eea58805df6398af16e.tar.gz |
transport: always call the certificate check callback
We should let the user decide whether to cancel the connection or not
regardless of whether our checks have decided that the certificate is
fine. We provide our own assessment to the callback to let the user fall
back to our checks if they so desire.
Diffstat (limited to 'tests/online')
-rw-r--r-- | tests/online/clone.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c index 2e8db2b64..0e9a17663 100644 --- a/tests/online/clone.c +++ b/tests/online/clone.c @@ -470,14 +470,15 @@ 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, void *payload) +static int fail_certificate_check(git_cert_t type, void *data, size_t len, int valid, void *payload) { GIT_UNUSED(type); GIT_UNUSED(data); GIT_UNUSED(len); + GIT_UNUSED(valid); GIT_UNUSED(payload); - return GIT_EUSER; + return 0; } void test_online_clone__certificate_invalid(void) @@ -485,17 +486,18 @@ void test_online_clone__certificate_invalid(void) g_options.remote_callbacks.certificate_check = fail_certificate_check; cl_git_fail_with(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options), - GIT_EUSER); + GIT_ECERTIFICATE); } -static int succeed_certificate_check(git_cert_t type, void *data, size_t len, void *payload) +static int succeed_certificate_check(git_cert_t type, void *data, size_t len, int valid, void *payload) { GIT_UNUSED(type); GIT_UNUSED(data); GIT_UNUSED(len); + GIT_UNUSED(valid); GIT_UNUSED(payload); - return 0; + return 1; } void test_online_clone__certificate_valid(void) |