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
9b81eec9
Commit
9b81eec9
authored
Apr 21, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Remove trailing "." from SAN DNS name and CN
parent
00bf7016
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+31
-1
No files found.
src/shrpx_ssl.cc
View file @
9b81eec9
...
...
@@ -984,11 +984,21 @@ int verify_hostname(X509 *cert, const StringRef &hostname,
}
auto
len
=
ASN1_STRING_length
(
altname
->
d
.
ia5
);
if
(
len
==
0
)
{
continue
;
}
if
(
std
::
find
(
name
,
name
+
len
,
'\0'
)
!=
name
+
len
)
{
// Embedded NULL is not permitted.
continue
;
}
if
(
name
[
len
-
1
]
==
'.'
)
{
--
len
;
if
(
len
==
0
)
{
continue
;
}
}
if
(
tls_hostname_match
(
StringRef
{
name
,
static_cast
<
size_t
>
(
len
)},
hostname
))
{
return
0
;
...
...
@@ -1140,7 +1150,7 @@ void CertLookupTree::add_cert(SSL_CTX *ssl_ctx, const StringRef &hostname) {
if
(
hostname
.
empty
())
{
return
;
}
// Copy hostname
including terminal NULL
// Copy hostname
auto
host_copy
=
make_unique
<
char
[]
>
(
hostname
.
size
()
+
1
);
std
::
copy
(
std
::
begin
(
hostname
),
std
::
end
(
hostname
),
host_copy
.
get
());
host_copy
[
hostname
.
size
()]
=
'\0'
;
...
...
@@ -1234,11 +1244,21 @@ int cert_lookup_tree_add_cert_from_file(CertLookupTree *lt, SSL_CTX *ssl_ctx,
}
auto
len
=
ASN1_STRING_length
(
altname
->
d
.
ia5
);
if
(
len
==
0
)
{
continue
;
}
if
(
std
::
find
(
name
,
name
+
len
,
'\0'
)
!=
name
+
len
)
{
// Embedded NULL is not permitted.
continue
;
}
if
(
name
[
len
-
1
]
==
'.'
)
{
--
len
;
if
(
len
==
0
)
{
continue
;
}
}
lt
->
add_cert
(
ssl_ctx
,
StringRef
{
name
,
static_cast
<
size_t
>
(
len
)});
}
}
...
...
@@ -1248,6 +1268,16 @@ int cert_lookup_tree_add_cert_from_file(CertLookupTree *lt, SSL_CTX *ssl_ctx,
return
0
;
}
if
(
cn
[
cn
.
size
()
-
1
]
==
'.'
)
{
if
(
cn
.
size
()
==
1
)
{
OPENSSL_free
(
const_cast
<
char
*>
(
cn
.
c_str
()));
return
0
;
}
cn
=
StringRef
{
cn
.
c_str
(),
cn
.
size
()
-
1
};
}
lt
->
add_cert
(
ssl_ctx
,
cn
);
OPENSSL_free
(
const_cast
<
char
*>
(
cn
.
c_str
()));
...
...
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