def ValidateCertificateHostname(cert, hostname):
 hosts = GetValidHostsForCert(cert)
 boto.log.debug('validating server certificate: hostname=%s, certificate hosts=%s', hostname, hosts)
 for host in hosts:
  host_re = host.replace('.', '\\.').replace('*', '[^.]*')
  if re.search(('^%s$' % (host_re,)), hostname, re.I):
   return True
 return False

def ValidateCertificateHostname ( cert , hostname ) : hosts = GetValidHostsForCert ( cert ) boto . log . debug ( 'validating server certificate: hostname=%s, certificate hosts=%s' , hostname , hosts ) for host in hosts : host_re = host . replace ( '.' , '\\.' ) . replace ( '*' , '[^.]*' ) if re . search ( ( '^%s$' % ( host_re , ) ) , hostname , re . I ) : return True return False
validates that a given hostname is valid for an ssl certificate .