Change in vdsm[master]: m2c: use custom certificate validation function

phoracek at redhat.com phoracek at redhat.com
Thu Feb 18 14:34:42 UTC 2016


Petr Horáček has posted comments on this change.

Change subject: m2c: use custom certificate validation function
......................................................................


Patch Set 1:

(4 comments)

https://gerrit.ovirt.org/#/c/53398/1/lib/vdsm/m2cutils.py
File lib/vdsm/m2cutils.py:

Line 102: 
Line 103:         commonNames = ''
Line 104:         hasCommonName = False
Line 105: 
Line 106:         for entry in peercert.get_subject().get_entries_by_nid(13):
IMO a constant would be better than 13
Line 107:             hasCommonName = True
Line 108:             commonName = entry.get_data().as_text()
Line 109:             if not commonNames:
Line 110:                 commonNames = commonName


Line 105: 
Line 106:         for entry in peercert.get_subject().get_entries_by_nid(13):
Line 107:             hasCommonName = True
Line 108:             commonName = entry.get_data().as_text()
Line 109:             if not commonNames:
positive testing first?

 if commonNames:
     commonNames += ',' + commonName
 else:
     commonNames = commonName
Line 110:                 commonNames = commonName
Line 111:             else:
Line 112:                 commonNames += ',' + commonName
Line 113: 


Line 110:                 commonNames = commonName
Line 111:             else:
Line 112:                 commonNames += ',' + commonName
Line 113: 
Line 114:         if not hasCommonName:
positive testing
Line 115:             return False
Line 116:         else:
Line 117:             return self._compare_names(addr, commonNames)
Line 118: 


Line 116:         else:
Line 117:             return self._compare_names(addr, commonNames)
Line 118: 
Line 119:     def _compare_names(self, addr, name):
Line 120:         if addr == name or addr == '127.0.0.1' or addr == '::1':
or

 if addr in (name, '127.0.0.1', '::1')
Line 121:             return True
Line 122:         else:
Line 123:             return name.lower() == socket.gethostbyaddr(addr)[0].lower()
Line 124: 


-- 
To view, visit https://gerrit.ovirt.org/53398
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Icc85ae6b0acd7a34bcd60aa47a4192ebd7e7581f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Marcin Mirecki <mmirecki at redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list