MCPcopy Index your code
hub / github.com/python/cpython / _ipaddress_match

Function _ipaddress_match

Lib/ssl.py:364–373  ·  view source on GitHub ↗

Exact matching of IP addresses. RFC 6125 explicitly doesn't define an algorithm for this (section 1.7.2 - "Out of Scope").

(cert_ipaddress, host_ip)

Source from the content-addressed store, hash-verified

362
363
364def _ipaddress_match(cert_ipaddress, host_ip):
365 """Exact matching of IP addresses.
366
367 RFC 6125 explicitly doesn't define an algorithm for this
368 (section 1.7.2 - "Out of Scope").
369 """
370 # OpenSSL may add a trailing newline to a subjectAltName's IP address,
371 # commonly with IPv6 addresses. Strip off trailing \n.
372 ip = _inet_paton(cert_ipaddress.rstrip())
373 return ip == host_ip
374
375
376DefaultVerifyPaths = namedtuple("DefaultVerifyPaths",

Callers

nothing calls this directly

Calls 2

_inet_patonFunction · 0.85
rstripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…