##// 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 b' def validatesocket(sock):'
386 section = 'hostsecurity'
386 section = 'hostsecurity'
387
387
388 if settings['certfingerprints']:
388 if settings['certfingerprints']:
389 fingerprintmatch = False
390 for hash, fingerprint in settings['certfingerprints']:
389 for hash, fingerprint in settings['certfingerprints']:
391 if peerfingerprints[hash].lower() == fingerprint:
390 if peerfingerprints[hash].lower() == fingerprint:
392 fingerprintmatch = True
391 ui.debug('%s certificate matched fingerprint %s:%s\n' %
393 break
392 (host, hash, fmtfingerprint(fingerprint)))
394 if not fingerprintmatch:
393 return
395 raise error.Abort(_('certificate for %s has unexpected '
394
396 'fingerprint %s') % (host, legacyfingerprint),
395 raise error.Abort(_('certificate for %s has unexpected '
397 hint=_('check %s configuration') % section)
396 'fingerprint %s') % (host, legacyfingerprint),
398 ui.debug('%s certificate matched fingerprint %s\n' %
397 hint=_('check %s configuration') % section)
399 (host, legacyfingerprint))
400 return
401
398
402 if not sock._hgstate['caloaded']:
399 if not sock._hgstate['caloaded']:
403 ui.warn(_('warning: %s certificate with fingerprint %s '
400 ui.warn(_('warning: %s certificate with fingerprint %s '
General Comments 0
You need to be logged in to leave comments. Login now