MCPcopy Create free account
hub / github.com/libgit2/pygit2 / _certificate_check_cb

Function _certificate_check_cb

pygit2/callbacks.py:538–558  ·  view source on GitHub ↗
(cert_i, valid, host, data)

Source from the content-addressed store, hash-verified

536
537@libgit2_callback
538def _certificate_check_cb(cert_i, valid, host, data):
539 # We want to simulate what should happen if libgit2 supported pass-through
540 # for this callback. For SSH, 'valid' is always False, because it doesn't
541 # look at known_hosts, but we do want to let it through in order to do what
542 # libgit2 would if the callback were not set.
543 try:
544 is_ssh = cert_i.cert_type == C.GIT_CERT_HOSTKEY_LIBSSH2
545
546 # python's parsing is deep in the libraries and assumes an OpenSSL-owned cert
547 val = data.certificate_check(None, bool(valid), ffi.string(host))
548 if not val:
549 return C.GIT_ECERTIFICATE
550 except Passthrough:
551 if is_ssh:
552 return 0
553 elif valid:
554 return 0
555 else:
556 return C.GIT_ECERTIFICATE
557
558 return 0
559
560
561@libgit2_callback

Callers

nothing calls this directly

Calls 2

stringMethod · 0.80
certificate_checkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…