summaryrefslogtreecommitdiff
path: root/src/transports
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-09-16 02:27:16 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-09-16 17:02:32 +0200
commit286369a81fc2e1d77a7a134d5c140f023af1298b (patch)
tree6e93287c02cc6153860ed0323da95a3b9772edd5 /src/transports
parentebda0970765e881feddd1879fb39ac9a3aa951a8 (diff)
downloadlibgit2-286369a81fc2e1d77a7a134d5c140f023af1298b.tar.gz
ssh: provide our own types for host key lengths
Instead of using the libssh2 defines, provide our own, which eases usage as we do not need to check whether libgit2 was built with libssh2 or not.
Diffstat (limited to 'src/transports')
-rw-r--r--src/transports/ssh.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index 298209150..717565327 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -480,23 +480,21 @@ static int _git_ssh_setup_conn(
goto on_error;
if (t->owner->certificate_check_cb != NULL) {
- git_cert_hostkey cert;
+ git_cert_hostkey cert = { 0 };
const char *key;
- size_t certlen;
cert.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
- cert.type = LIBSSH2_HOSTKEY_HASH_SHA1;
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
if (key != NULL) {
- certlen = 20;
- memcpy(&cert.hash, key, certlen);
+ cert.type = GIT_CERT_SSH_SHA1;
+ memcpy(&cert.hash, key, 20);
} else {
- cert.type = LIBSSH2_HOSTKEY_HASH_MD5;
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
- certlen = 16;
- if (key != NULL)
- memcpy(&cert.hash, key, certlen);
+ if (key != NULL) {
+ cert.type = GIT_CERT_SSH_MD5;
+ memcpy(&cert.hash, key, 16);
+ }
}
if (key == NULL) {