Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
9b36537d
Commit
9b36537d
authored
Oct 10, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2588 from swansontec/ssl-cert-path2
Add support for setting the SSL CA location
parents
0625638f
737b445a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
+35
-1
include/git2/common.h
+13
-1
src/settings.c
+22
-0
No files found.
include/git2/common.h
View file @
9b36537d
...
...
@@ -138,7 +138,8 @@ typedef enum {
GIT_OPT_ENABLE_CACHING
,
GIT_OPT_GET_CACHED_MEMORY
,
GIT_OPT_GET_TEMPLATE_PATH
,
GIT_OPT_SET_TEMPLATE_PATH
GIT_OPT_SET_TEMPLATE_PATH
,
GIT_OPT_SET_SSL_CERT_LOCATIONS
,
}
git_libgit2_opt_t
;
/**
...
...
@@ -223,6 +224,17 @@ typedef enum {
* >
* > - `path` directory of template.
*
* * opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, const char *file, const char *path)
*
* > 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 `NULL`, but not both.
*
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure
...
...
src/settings.c
View file @
9b36537d
...
...
@@ -5,10 +5,15 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifdef GIT_SSL
# include <openssl/err.h>
#endif
#include <git2.h>
#include "common.h"
#include "sysdir.h"
#include "cache.h"
#include "global.h"
void
git_libgit2_version
(
int
*
major
,
int
*
minor
,
int
*
rev
)
{
...
...
@@ -131,6 +136,23 @@ int git_libgit2_opts(int key, ...)
case
GIT_OPT_SET_TEMPLATE_PATH
:
error
=
git_sysdir_set
(
GIT_SYSDIR_TEMPLATE
,
va_arg
(
ap
,
const
char
*
));
break
;
case
GIT_OPT_SET_SSL_CERT_LOCATIONS
:
#ifdef GIT_SSL
{
const
char
*
file
=
va_arg
(
ap
,
const
char
*
);
const
char
*
path
=
va_arg
(
ap
,
const
char
*
);
if
(
!
SSL_CTX_load_verify_locations
(
git__ssl_ctx
,
file
,
path
))
{
giterr_set
(
GITERR_NET
,
"SSL error: %s"
,
ERR_error_string
(
ERR_get_error
(),
NULL
));
error
=
-
1
;
}
}
#else
giterr_set
(
GITERR_NET
,
"Cannot set certificate locations: OpenSSL is not enabled"
);
error
=
-
1
;
#endif
break
;
}
va_end
(
ap
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment