diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-10-19 14:35:22 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-10-19 14:38:00 +0200 |
| commit | 3b7cc1e97e62cf240f93a08983a0dc18bd31c54c (patch) | |
| tree | 17c6b3153830837402a5bc86863fde72904981c1 | |
| parent | 68bd3bbdd7f0d528c6576076bc3b53cf666d4bb0 (diff) | |
remote: use the library's certificate validity if no callback is set
We should not return 0, as in this case that means we let it through,
return an appropriate error instead.
| -rw-r--r-- | remote.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -160,8 +160,13 @@ func updateTipsCallback(_refname *C.char, _a *C.git_oid, _b *C.git_oid, data uns //export certificateCheckCallback func certificateCheckCallback(_cert *C.git_cert, _valid C.int, _host *C.char, data unsafe.Pointer) int { callbacks := (*RemoteCallbacks)(data) + // if there's no callback set, we need to make sure we fail if the library didn't consider this cert valid if callbacks.CertificateCheckCallback == nil { - return 0 + if _valid == 1 { + return 0 + } else { + return C.GIT_ECERTIFICATE + } } host := C.GoString(_host) valid := _valid != 0 |
