Skip to content

Commit

Permalink
Add binding for GIT_OPT_SET_SSL_CERT_LOCATIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
aharbis committed Oct 31, 2023
1 parent dc63db5 commit f43a7e2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<P>(file: Option<P>, path: Option<P>) -> 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::*;
Expand Down

0 comments on commit f43a7e2

Please sign in to comment.