Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
b39ad313
Commit
b39ad313
authored
Apr 26, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Don't use CN if we have dNSName or iPAddress field
parent
13f97ccf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+22
-0
No files found.
src/shrpx_ssl.cc
View file @
b39ad313
...
...
@@ -925,6 +925,7 @@ int verify_numeric_hostname(X509 *cert, const StringRef &hostname,
if
(
altnames
)
{
auto
altnames_deleter
=
defer
(
GENERAL_NAMES_free
,
altnames
);
size_t
n
=
sk_GENERAL_NAME_num
(
altnames
);
auto
ip_found
=
false
;
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
altname
=
sk_GENERAL_NAME_value
(
altnames
,
i
);
if
(
altname
->
type
!=
GEN_IPADD
)
{
...
...
@@ -937,10 +938,15 @@ int verify_numeric_hostname(X509 *cert, const StringRef &hostname,
}
size_t
ip_addrlen
=
altname
->
d
.
iPAddress
->
length
;
ip_found
=
true
;
if
(
addr
->
len
==
ip_addrlen
&&
memcmp
(
saddr
,
ip_addr
,
ip_addrlen
)
==
0
)
{
return
0
;
}
}
if
(
ip_found
)
{
return
-
1
;
}
}
auto
cn
=
get_common_name
(
cert
);
...
...
@@ -970,6 +976,7 @@ int verify_hostname(X509 *cert, const StringRef &hostname,
auto
altnames
=
static_cast
<
GENERAL_NAMES
*>
(
X509_get_ext_d2i
(
cert
,
NID_subject_alt_name
,
nullptr
,
nullptr
));
if
(
altnames
)
{
auto
dns_found
=
false
;
auto
altnames_deleter
=
defer
(
GENERAL_NAMES_free
,
altnames
);
size_t
n
=
sk_GENERAL_NAME_num
(
altnames
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
...
...
@@ -999,11 +1006,19 @@ int verify_hostname(X509 *cert, const StringRef &hostname,
}
}
dns_found
=
true
;
if
(
tls_hostname_match
(
StringRef
{
name
,
static_cast
<
size_t
>
(
len
)},
hostname
))
{
return
0
;
}
}
// RFC 6125, section 6.4.4. says that client MUST not seek a match
// for CN if a dns dNSName is found.
if
(
dns_found
)
{
return
-
1
;
}
}
auto
cn
=
get_common_name
(
cert
);
...
...
@@ -1237,6 +1252,7 @@ int cert_lookup_tree_add_cert_from_file(CertLookupTree *lt, SSL_CTX *ssl_ctx,
if
(
altnames
)
{
auto
altnames_deleter
=
defer
(
GENERAL_NAMES_free
,
altnames
);
size_t
n
=
sk_GENERAL_NAME_num
(
altnames
);
auto
dns_found
=
false
;
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
altname
=
sk_GENERAL_NAME_value
(
altnames
,
i
);
if
(
altname
->
type
!=
GEN_DNS
)
{
...
...
@@ -1264,8 +1280,14 @@ int cert_lookup_tree_add_cert_from_file(CertLookupTree *lt, SSL_CTX *ssl_ctx,
}
}
dns_found
=
true
;
lt
->
add_cert
(
ssl_ctx
,
StringRef
{
name
,
static_cast
<
size_t
>
(
len
)});
}
// Don't bother CN if we have dNSName.
if
(
dns_found
)
{
return
0
;
}
}
auto
cn
=
get_common_name
(
cert
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment