Skip to content

Commit

Permalink
Fix certificate check callback
Browse files Browse the repository at this point in the history
Fixes: #945 #1262
  • Loading branch information
sathieu authored Oct 10, 2024
1 parent 923cfaa commit 780e222
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pygit2/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ class RemoteCallbacks(Payload):
RemoteCallbacks(certificate=certificate).
"""

def __init__(self, credentials=None, certificate=None):
def __init__(self, credentials=None, certificate_check=None):
super().__init__()
if credentials is not None:
self.credentials = credentials
if certificate is not None:
self.certificate = certificate
if certificate_check is not None:
self.certificate_check = certificate_check

def sideband_progress(self, string):
"""
Expand Down Expand Up @@ -344,7 +344,7 @@ def git_fetch_options(payload, opts=None):
opts.callbacks.transfer_progress = C._transfer_progress_cb
opts.callbacks.update_tips = C._update_tips_cb
opts.callbacks.credentials = C._credentials_cb
opts.callbacks.certificate_check = C._certificate_cb
opts.callbacks.certificate_check = C._certificate_check_cb
# Payload
handle = ffi.new_handle(payload)
opts.callbacks.payload = handle
Expand All @@ -368,7 +368,7 @@ def git_push_options(payload, opts=None):
opts.callbacks.transfer_progress = C._transfer_progress_cb
opts.callbacks.update_tips = C._update_tips_cb
opts.callbacks.credentials = C._credentials_cb
opts.callbacks.certificate_check = C._certificate_cb
opts.callbacks.certificate_check = C.
opts.callbacks.push_update_reference = C._push_update_reference_cb
# Payload
handle = ffi.new_handle(payload)
Expand Down Expand Up @@ -457,7 +457,7 @@ def wrapper(*args):


@libgit2_callback
def _certificate_cb(cert_i, valid, host, data):
def _certificate_check_cb(cert_i, valid, host, data):
# We want to simulate what should happen if libgit2 supported pass-through
# for this callback. For SSH, 'valid' is always False, because it doesn't
# look at known_hosts, but we do want to let it through in order to do what
Expand Down

0 comments on commit 780e222

Please sign in to comment.