shrpx: Fix bug in building certificate lookup tree
This commit is contained in:
parent
c8167234fa
commit
64fcac48b7
|
@ -587,7 +587,11 @@ void cert_lookup_tree_add_cert(CertLookupTree *lt, CertNode *node,
|
||||||
cn->str[i] == hostname[j]; --i, --j);
|
cn->str[i] == hostname[j]; --i, --j);
|
||||||
if(i == cn->last) {
|
if(i == cn->last) {
|
||||||
if(j == -1) {
|
if(j == -1) {
|
||||||
// same hostname, we don't overwrite exiting ssl_ctx
|
if(cn->ssl_ctx) {
|
||||||
|
// same hostname, we don't overwrite exiting ssl_ctx
|
||||||
|
} else {
|
||||||
|
cn->ssl_ctx = ssl_ctx;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// The existing hostname is a suffix of this hostname.
|
// The existing hostname is a suffix of this hostname.
|
||||||
// Continue matching at potion j.
|
// Continue matching at potion j.
|
||||||
|
|
|
@ -96,9 +96,10 @@ void test_shrpx_ssl_create_lookup_tree(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SSL_CTX *ctxs2[] = {SSL_CTX_new(TLSv1_method()),
|
SSL_CTX *ctxs2[] = {SSL_CTX_new(TLSv1_method()),
|
||||||
|
SSL_CTX_new(TLSv1_method()),
|
||||||
SSL_CTX_new(TLSv1_method()),
|
SSL_CTX_new(TLSv1_method()),
|
||||||
SSL_CTX_new(TLSv1_method())};
|
SSL_CTX_new(TLSv1_method())};
|
||||||
const char *names[] = { "rab", "zab", "zzub" };
|
const char *names[] = { "rab", "zab", "zzub", "ab" };
|
||||||
num = sizeof(ctxs2)/sizeof(ctxs2[0]);
|
num = sizeof(ctxs2)/sizeof(ctxs2[0]);
|
||||||
tree = ssl::cert_lookup_tree_new();
|
tree = ssl::cert_lookup_tree_new();
|
||||||
for(int i = 0; i < num; ++i) {
|
for(int i = 0; i < num; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue