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
f2a328fa
Commit
f2a328fa
authored
Jul 10, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3272 from ethomson/cert
git_cert: child types use proper base type
parents
9847d80d
79698030
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
34 deletions
+32
-34
CHANGELOG.md
+4
-0
include/git2/transport.h
+14
-21
src/curl_stream.c
+7
-7
src/openssl_stream.c
+3
-2
src/stransport_stream.c
+1
-1
src/transports/ssh.c
+2
-2
src/transports/winhttp.c
+1
-1
No files found.
CHANGELOG.md
View file @
f2a328fa
...
@@ -7,6 +7,10 @@ v0.23 + 1
...
@@ -7,6 +7,10 @@ v0.23 + 1
### API removals
### API removals
### Breaking API changes
*
`git_cert`
descendent types now have a proper
`parent`
member
v0.23
v0.23
------
------
...
...
include/git2/transport.h
View file @
f2a328fa
...
@@ -37,39 +37,32 @@ typedef enum {
...
@@ -37,39 +37,32 @@ typedef enum {
* Hostkey information taken from libssh2
* Hostkey information taken from libssh2
*/
*/
typedef
struct
{
typedef
struct
{
git_cert
parent
;
/**
/**
*
Type of certificate. Here to share the header with
*
A hostkey type from libssh2, either
* `
git_cert`.
* `
GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
*/
*/
git_cert_t
cert_type
;
/**
* A hostkey type from libssh2, either
* `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
*/
git_cert_ssh_t
type
;
git_cert_ssh_t
type
;
/**
/**
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
* have the MD5 hash of the hostkey.
* have the MD5 hash of the hostkey.
*/
*/
unsigned
char
hash_md5
[
16
];
unsigned
char
hash_md5
[
16
];
/**
/**
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
* have the SHA-1 hash of the hostkey.
* have the SHA-1 hash of the hostkey.
*/
*/
unsigned
char
hash_sha1
[
20
];
unsigned
char
hash_sha1
[
20
];
}
git_cert_hostkey
;
}
git_cert_hostkey
;
/**
/**
* X.509 certificate information
* X.509 certificate information
*/
*/
typedef
struct
{
typedef
struct
{
/**
git_cert
parent
;
* Type of certificate. Here to share the header with
* `git_cert`.
*/
git_cert_t
cert_type
;
/**
/**
* Pointer to the X.509 certificate data
* Pointer to the X.509 certificate data
*/
*/
...
...
src/curl_stream.c
View file @
f2a328fa
...
@@ -67,9 +67,9 @@ static int curls_certificate(git_cert **out, git_stream *stream)
...
@@ -67,9 +67,9 @@ static int curls_certificate(git_cert **out, git_stream *stream)
/* No information is available, can happen with SecureTransport */
/* No information is available, can happen with SecureTransport */
if
(
certinfo
->
num_of_certs
==
0
)
{
if
(
certinfo
->
num_of_certs
==
0
)
{
s
->
cert_info
.
cert_type
=
GIT_CERT_NONE
;
s
->
cert_info
.
parent
.
cert_type
=
GIT_CERT_NONE
;
s
->
cert_info
.
data
=
NULL
;
s
->
cert_info
.
data
=
NULL
;
s
->
cert_info
.
len
=
0
;
s
->
cert_info
.
len
=
0
;
return
0
;
return
0
;
}
}
...
@@ -85,11 +85,11 @@ static int curls_certificate(git_cert **out, git_stream *stream)
...
@@ -85,11 +85,11 @@ static int curls_certificate(git_cert **out, git_stream *stream)
s
->
cert_info_strings
.
strings
=
(
char
**
)
strings
.
contents
;
s
->
cert_info_strings
.
strings
=
(
char
**
)
strings
.
contents
;
s
->
cert_info_strings
.
count
=
strings
.
length
;
s
->
cert_info_strings
.
count
=
strings
.
length
;
s
->
cert_info
.
cert_type
=
GIT_CERT_STRARRAY
;
s
->
cert_info
.
parent
.
cert_type
=
GIT_CERT_STRARRAY
;
s
->
cert_info
.
data
=
&
s
->
cert_info_strings
;
s
->
cert_info
.
data
=
&
s
->
cert_info_strings
;
s
->
cert_info
.
len
=
strings
.
length
;
s
->
cert_info
.
len
=
strings
.
length
;
*
out
=
(
git_cert
*
)
&
s
->
cert_info
;
*
out
=
&
s
->
cert_info
.
parent
;
return
0
;
return
0
;
}
}
...
...
src/openssl_stream.c
View file @
f2a328fa
...
@@ -358,11 +358,12 @@ int openssl_certificate(git_cert **out, git_stream *stream)
...
@@ -358,11 +358,12 @@ int openssl_certificate(git_cert **out, git_stream *stream)
return
-
1
;
return
-
1
;
}
}
st
->
cert_info
.
cert_type
=
GIT_CERT_X509
;
st
->
cert_info
.
parent
.
cert_type
=
GIT_CERT_X509
;
st
->
cert_info
.
data
=
encoded_cert
;
st
->
cert_info
.
data
=
encoded_cert
;
st
->
cert_info
.
len
=
len
;
st
->
cert_info
.
len
=
len
;
*
out
=
(
git_cert
*
)
&
st
->
cert_info
;
*
out
=
&
st
->
cert_info
.
parent
;
return
0
;
return
0
;
}
}
...
...
src/stransport_stream.c
View file @
f2a328fa
...
@@ -108,7 +108,7 @@ int stransport_certificate(git_cert **out, git_stream *stream)
...
@@ -108,7 +108,7 @@ int stransport_certificate(git_cert **out, git_stream *stream)
return
-
1
;
return
-
1
;
}
}
st
->
cert_info
.
cert_type
=
GIT_CERT_X509
;
st
->
cert_info
.
parent
.
cert_type
=
GIT_CERT_X509
;
st
->
cert_info
.
data
=
(
void
*
)
CFDataGetBytePtr
(
st
->
der_data
);
st
->
cert_info
.
data
=
(
void
*
)
CFDataGetBytePtr
(
st
->
der_data
);
st
->
cert_info
.
len
=
CFDataGetLength
(
st
->
der_data
);
st
->
cert_info
.
len
=
CFDataGetLength
(
st
->
der_data
);
...
...
src/transports/ssh.c
View file @
f2a328fa
...
@@ -525,10 +525,10 @@ static int _git_ssh_setup_conn(
...
@@ -525,10 +525,10 @@ static int _git_ssh_setup_conn(
goto
done
;
goto
done
;
if
(
t
->
owner
->
certificate_check_cb
!=
NULL
)
{
if
(
t
->
owner
->
certificate_check_cb
!=
NULL
)
{
git_cert_hostkey
cert
=
{
0
},
*
cert_ptr
;
git_cert_hostkey
cert
=
{
{
0
}
},
*
cert_ptr
;
const
char
*
key
;
const
char
*
key
;
cert
.
cert_type
=
GIT_CERT_HOSTKEY_LIBSSH2
;
cert
.
parent
.
cert_type
=
GIT_CERT_HOSTKEY_LIBSSH2
;
key
=
libssh2_hostkey_hash
(
session
,
LIBSSH2_HOSTKEY_HASH_SHA1
);
key
=
libssh2_hostkey_hash
(
session
,
LIBSSH2_HOSTKEY_HASH_SHA1
);
if
(
key
!=
NULL
)
{
if
(
key
!=
NULL
)
{
...
...
src/transports/winhttp.c
View file @
f2a328fa
...
@@ -228,7 +228,7 @@ static int certificate_check(winhttp_stream *s, int valid)
...
@@ -228,7 +228,7 @@ static int certificate_check(winhttp_stream *s, int valid)
}
}
giterr_clear
();
giterr_clear
();
cert
.
cert_type
=
GIT_CERT_X509
;
cert
.
parent
.
cert_type
=
GIT_CERT_X509
;
cert
.
data
=
cert_ctx
->
pbCertEncoded
;
cert
.
data
=
cert_ctx
->
pbCertEncoded
;
cert
.
len
=
cert_ctx
->
cbCertEncoded
;
cert
.
len
=
cert_ctx
->
cbCertEncoded
;
error
=
t
->
owner
->
certificate_check_cb
((
git_cert
*
)
&
cert
,
valid
,
t
->
connection_data
.
host
,
t
->
owner
->
cred_acquire_payload
);
error
=
t
->
owner
->
certificate_check_cb
((
git_cert
*
)
&
cert
,
valid
,
t
->
connection_data
.
host
,
t
->
owner
->
cred_acquire_payload
);
...
...
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