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
af6dab7e
Commit
af6dab7e
authored
Aug 13, 2013
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect GIT_SSL_NO_VERIFY and http.sslVerify
parent
14da6182
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
src/remote.c
+27
-2
No files found.
src/remote.c
View file @
af6dab7e
...
...
@@ -81,6 +81,31 @@ static int ensure_remote_name_is_valid(const char *name)
return
error
;
}
static
int
get_check_cert
(
git_repository
*
repo
)
{
git_config
*
cfg
;
const
char
*
val
;
int
check_cert
;
assert
(
repo
);
/* Go through the possible sources for SSL verification settings, from
* most specific to least specific. */
/* GIT_SSL_NO_VERIFY environment variable */
if
((
val
=
getenv
(
"GIT_SSL_NO_VERIFY"
))
&&
!
git_config_parse_bool
(
&
check_cert
,
val
))
return
!
check_cert
;
/* http.sslVerify config setting */
if
(
!
git_repository_config__weakptr
(
&
cfg
,
repo
)
&&
!
git_config_get_bool
(
&
check_cert
,
cfg
,
"http.sslVerify"
))
return
check_cert
;
/* By default, we *DO* want to verify the certificate. */
return
1
;
}
static
int
create_internal
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
)
{
git_remote
*
remote
;
...
...
@@ -94,7 +119,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
GITERR_CHECK_ALLOC
(
remote
);
remote
->
repo
=
repo
;
remote
->
check_cert
=
1
;
remote
->
check_cert
=
(
unsigned
)
get_check_cert
(
repo
)
;
remote
->
update_fetchhead
=
1
;
if
(
git_vector_init
(
&
remote
->
refs
,
32
,
NULL
)
<
0
)
...
...
@@ -253,7 +278,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
GITERR_CHECK_ALLOC
(
remote
);
memset
(
remote
,
0x0
,
sizeof
(
git_remote
));
remote
->
check_cert
=
1
;
remote
->
check_cert
=
(
unsigned
)
get_check_cert
(
repo
)
;
remote
->
update_fetchhead
=
1
;
remote
->
name
=
git__strdup
(
name
);
GITERR_CHECK_ALLOC
(
remote
->
name
);
...
...
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