Skip to content

Commit f43a7e2

Browse files
committed
Add binding for GIT_OPT_SET_SSL_CERT_LOCATIONS
1 parent dc63db5 commit f43a7e2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/opts.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,28 @@ pub unsafe fn set_verify_owner_validation(enabled: bool) -> Result<(), Error> {
195195
Ok(())
196196
}
197197

198+
/// Set the SSL certificate-authority locations. `file` is the location of a file containing
199+
/// several certificates concatenated together. `path` is the location of a directory holding
200+
/// several certificates, one per file. Either parameter may be `None`, but not both.
201+
pub unsafe fn set_ssl_cert_locations<P>(file: Option<P>, path: Option<P>) -> Result<(), Error>
202+
where
203+
P: IntoCString,
204+
{
205+
crate::init();
206+
let file = crate::opt_cstr(file)?;
207+
let path = crate::opt_cstr(path)?;
208+
209+
unsafe {
210+
try_call!(raw::git_libgit2_opts(
211+
raw::GIT_OPT_SET_SSL_CERT_LOCATIONS as libc::c_int,
212+
file,
213+
path
214+
));
215+
}
216+
217+
Ok(())
218+
}
219+
198220
#[cfg(test)]
199221
mod test {
200222
use super::*;

0 commit comments

Comments
 (0)