From f43a7e288708ef2a6d4f1d284b07926d702ed931 Mon Sep 17 00:00:00 2001 From: Aidan Harbison Date: Tue, 31 Oct 2023 14:20:08 -0400 Subject: [PATCH] Add binding for GIT_OPT_SET_SSL_CERT_LOCATIONS --- src/opts.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/opts.rs b/src/opts.rs index e90bea0b12..270333b6c1 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -195,6 +195,28 @@ pub unsafe fn set_verify_owner_validation(enabled: bool) -> Result<(), Error> { Ok(()) } +/// Set the SSL certificate-authority locations. `file` is the location of a file containing +/// several certificates concatenated together. `path` is the location of a directory holding +/// several certificates, one per file. Either parameter may be `None`, but not both. +pub unsafe fn set_ssl_cert_locations

(file: Option

, path: Option

) -> Result<(), Error> +where + P: IntoCString, +{ + crate::init(); + let file = crate::opt_cstr(file)?; + let path = crate::opt_cstr(path)?; + + unsafe { + try_call!(raw::git_libgit2_opts( + raw::GIT_OPT_SET_SSL_CERT_LOCATIONS as libc::c_int, + file, + path + )); + } + + Ok(()) +} + #[cfg(test)] mod test { use super::*;