Commit de062fe
committed
ext/openssl: Match IPv6 IPADDR SAN when connecting to bracketed URI
php_openssl_get_url_name() returns NULL for resourcenames of the form
"[::1]:port" because php_url_parse_ex() cannot extract a host from a
bracketed hostport when no scheme is present. With url_name unset, the
SAN matcher falls back to peer_name which is also unset under default
client config, so verify_peer_name silently rejects every IPv6 literal
target even when the cert carries the matching IPADDR SAN entry.
Handle the bare "[host]:port" form before php_url_parse_ex() and strip
surrounding brackets on the parse path for callers that pass a full
"ssl://[::1]:port" URL. The SAN matcher's inet_pton(AF_INET6, ...) call
now sees "::1" instead of "[::1]" and the 16-byte IPADDR SAN comparison
body runs.1 parent 05afc37 commit de062fe
2 files changed
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2760 | 2760 | | |
2761 | 2761 | | |
2762 | 2762 | | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
2763 | 2770 | | |
2764 | 2771 | | |
2765 | 2772 | | |
| |||
2775 | 2782 | | |
2776 | 2783 | | |
2777 | 2784 | | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
2778 | 2790 | | |
2779 | 2791 | | |
2780 | 2792 | | |
| |||
0 commit comments