summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-23 13:59:59 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 15:47:31 +0100
commit7c3313a3baaa3695081a9c17b521931877babad6 (patch)
tree83bd53d8019da2644d00c13d446fc292c2b2782c /src/buildtool/file_system/git_repo.cpp
parent584f4b47b4e8cb59a9bdc3942be8d0bcd7e3cea7 (diff)
downloadjustbuild-7c3313a3baaa3695081a9c17b521931877babad6.tar.gz
GitRepo: Add SSL certificate verification callbacks for remote commit update
The libgit2 library does not satisfy the http.sslVerify gitconfig field or the GIT_SSL_NO_VERIFY environment variable, so we have to perform these checks ourselves and supply the correct return value from the certificate_check git_fetch_options callback. The callbacks used for fixing the remote fetch SSL certificate verification are reused here.
Diffstat (limited to 'src/buildtool/file_system/git_repo.cpp')
-rw-r--r--src/buildtool/file_system/git_repo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index c89c7610..d2d6c8ef 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -833,6 +833,10 @@ auto GitRepo::GetCommitFromRemote(std::string const& repo_url,
git_remote_callbacks callbacks{};
git_remote_init_callbacks(&callbacks, GIT_REMOTE_CALLBACKS_VERSION);
+ // set custom SSL verification callback
+ callbacks.certificate_check =
+ SetCustomSSLCertificateCheckCallback(repo_.get());
+
git_proxy_options proxy_opts{};
git_proxy_options_init(&proxy_opts, GIT_PROXY_OPTIONS_VERSION);