diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2014-10-10 11:28:58 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2014-10-10 11:28:58 -0400 |
commit | f54d8d528a5843075c6c60167d4659e393956fa3 (patch) | |
tree | cc9721fc6dc60364ccc0d742fd9c01856837635a /tests/online | |
parent | 533da4ea00703f4ad6d5518e1ce81d20261c40c0 (diff) | |
parent | db3d169c3351e31bab6cbddc7a7c29a0157f7a99 (diff) | |
download | libgit2-f54d8d528a5843075c6c60167d4659e393956fa3.tar.gz |
Merge pull request #2574 from csware/hostname-for-certificate_check_cb
Provide host name to certificate_check_cb
Diffstat (limited to 'tests/online')
-rw-r--r-- | tests/online/clone.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c index f7f3aaeda..13abd39bd 100644 --- a/tests/online/clone.c +++ b/tests/online/clone.c @@ -473,7 +473,7 @@ 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 *cert, int valid, void *payload) +int ssh_certificate_check(git_cert *cert, int valid, const char *host, void *payload) { git_cert_hostkey *key; git_oid expected = {{0}}, actual = {{0}}; @@ -504,6 +504,8 @@ int ssh_certificate_check(git_cert *cert, int valid, void *payload) cl_assert(!memcmp(&expected, &actual, 20)); + cl_assert_equal_s("localhost", host); + return GIT_EUSER; } @@ -523,10 +525,11 @@ void test_online_clone__url_with_no_path_returns_EINVALIDSPEC(void) GIT_EINVALIDSPEC); } -static int fail_certificate_check(git_cert *cert, int valid, void *payload) +static int fail_certificate_check(git_cert *cert, int valid, const char *host, void *payload) { GIT_UNUSED(cert); GIT_UNUSED(valid); + GIT_UNUSED(host); GIT_UNUSED(payload); return GIT_ECERTIFICATE; @@ -545,12 +548,14 @@ void test_online_clone__certificate_invalid(void) #endif } -static int succeed_certificate_check(git_cert *cert, int valid, void *payload) +static int succeed_certificate_check(git_cert *cert, int valid, const char *host, void *payload) { GIT_UNUSED(cert); GIT_UNUSED(valid); GIT_UNUSED(payload); + cl_assert_equal_s("github.com", host); + return 0; } |