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

piotr.kliczewski at gmail.com piotr.kliczewski at gmail.com
Thu Feb 18 14:56:52 UTC 2016


Piotr Kliczewski has posted comments on this change.

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


Patch Set 1:

(5 comments)

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

Line 96:     def __getattr__(self, name):
Line 97:         return getattr(self.connection, name)
Line 98: 
Line 99:     def _verify_host(self, peercert, addr=None):
Line 100:         if not peercert or peercert == {}:
> `if not peercert` is enough
Done
Line 101:             return False
Line 102: 
Line 103:         commonNames = ''
Line 104:         hasCommonName = False


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
Done
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?
Done
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
Done
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
Done
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: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list