##// END OF EJS Templates
sslutil: handle setups without .getpeercert() early in the validator...
Mads Kiilerich -
r15813:3ae04eb5 default
parent child Browse files
Show More
@@ -103,6 +103,13 b' class validator(object):'
103 103 host = self.host
104 104 cacerts = self.ui.config('web', 'cacerts')
105 105 hostfingerprint = self.ui.config('hostfingerprints', host)
106 if not getattr(sock, 'getpeercert', False): # python 2.5 ?
107 if hostfingerprint:
108 raise util.Abort(_("host fingerprint for %s can't be "
109 "verified (Python too old)") % host)
110 self.ui.warn(_("warning: certificate for %s can't be verified "
111 "(Python too old)\n") % host)
112 return
106 113 if cacerts and not hostfingerprint:
107 114 msg = _verifycert(sock.getpeercert(), host)
108 115 if msg:
@@ -111,7 +118,6 b' class validator(object):'
111 118 'insecurely)') % (host, msg))
112 119 self.ui.debug('%s certificate successfully verified\n' % host)
113 120 else:
114 if getattr(sock, 'getpeercert', False):
115 121 peercert = sock.getpeercert(True)
116 122 peerfingerprint = util.sha1(peercert).hexdigest()
117 123 nicefingerprint = ":".join([peerfingerprint[x:x + 2]
@@ -130,9 +136,3 b' class validator(object):'
130 136 '(check hostfingerprints or web.cacerts '
131 137 'config setting)\n') %
132 138 (host, nicefingerprint))
133 else: # python 2.5 ?
134 if hostfingerprint:
135 raise util.Abort(_("host fingerprint for %s can't be "
136 "verified (Python too old)") % host)
137 self.ui.warn(_("warning: certificate for %s can't be "
138 "verified (Python too old)\n") % host)
General Comments 0
You need to be logged in to leave comments. Login now