##// END OF EJS Templates
sslutil: refactor code for fingerprint matching...
Gregory Szorc -
r29291:15e533b7 default
parent child Browse files
Show More
@@ -386,18 +386,15 def validatesocket(sock):
386 386 section = 'hostsecurity'
387 387
388 388 if settings['certfingerprints']:
389 fingerprintmatch = False
390 389 for hash, fingerprint in settings['certfingerprints']:
391 390 if peerfingerprints[hash].lower() == fingerprint:
392 fingerprintmatch = True
393 break
394 if not fingerprintmatch:
395 raise error.Abort(_('certificate for %s has unexpected '
396 'fingerprint %s') % (host, legacyfingerprint),
397 hint=_('check %s configuration') % section)
398 ui.debug('%s certificate matched fingerprint %s\n' %
399 (host, legacyfingerprint))
400 return
391 ui.debug('%s certificate matched fingerprint %s:%s\n' %
392 (host, hash, fmtfingerprint(fingerprint)))
393 return
394
395 raise error.Abort(_('certificate for %s has unexpected '
396 'fingerprint %s') % (host, legacyfingerprint),
397 hint=_('check %s configuration') % section)
401 398
402 399 if not sock._hgstate['caloaded']:
403 400 ui.warn(_('warning: %s certificate with fingerprint %s '
General Comments 0
You need to be logged in to leave comments. Login now