Skip to content

Commit 58e70cf

Browse files
committed
Follow the RFCs more closely in libpq server certificate hostname check.
The RFCs say that the CN must not be checked if a subjectAltName extension of type dNSName is present. IOW, if subjectAltName extension is present, but there are no dNSNames, we can still check the CN. Alexey Klyukin
1 parent 2df465e commit 58e70cf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/interfaces/libpq/fe-secure-openssl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,13 @@ verify_peer_name_matches_certificate(PGconn *conn)
626626
sk_GENERAL_NAME_free(peer_san);
627627
}
628628
/*
629-
* If there is no subjectAltName extension, check the Common Name.
629+
* If there is no subjectAltName extension of type dNSName, check the
630+
* Common Name.
630631
*
631-
* (Per RFC 2818 and RFC 6125, if the subjectAltName extension is present,
632-
* the CN must be ignored.)
632+
* (Per RFC 2818 and RFC 6125, if the subjectAltName extension of type
633+
* dNSName is present, the CN must be ignored.)
633634
*/
634-
else
635+
if (names_examined == 0)
635636
{
636637
X509_NAME *subject_name;
637638

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy