Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added certificate location setup
  • Loading branch information
wildart committed Jul 29, 2016
commit d44d0200a3ed26cdf7f851f36ddd24eb37eeb757
23 changes: 22 additions & 1 deletion src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
# include <openssl/err.h>
#endif

#ifdef GIT_MBEDTLS
# include <mbedtls/error.h>
#endif

#include <git2.h>
#include "common.h"
#include "sysdir.h"
Expand Down Expand Up @@ -174,8 +178,25 @@ int git_libgit2_opts(int key, ...)
error = -1;
}
}
#elif GIT_MBEDTLS
{
const char *file = va_arg(ap, const char *);
const char *path = va_arg(ap, const char *);
int ret = 0;
char errbuf[512];
if (!file) {
ret = mbedtls_x509_crt_parse_file(git__ssl_conf->ca_chain, file);
} else if (!path) {
ret = mbedtls_x509_crt_parse_path(git__ssl_conf->ca_chain, path);
}
if (ret != 0) {
mbedtls_strerror( ret, errbuf, 512 );
giterr_set(GITERR_NET, "SSL error: %d - %s", ret, errbuf);
error = -1;
}
}
#else
giterr_set(GITERR_NET, "cannot set certificate locations: OpenSSL is not enabled");
giterr_set(GITERR_NET, "Cannot set certificate locations: OpenSSL or mbedTLS is not enabled");
error = -1;
#endif
break;
Expand Down