1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-21 23:28:52 -05:00

shrpx: Fix bug in building certificate lookup tree

This commit is contained in:
Tatsuhiro Tsujikawa 2013-02-16 17:51:38 +09:00
parent c8167234fa
commit 64fcac48b7
2 changed files with 7 additions and 2 deletions

View File

@ -587,7 +587,11 @@ void cert_lookup_tree_add_cert(CertLookupTree *lt, CertNode *node,
cn->str[i] == hostname[j]; --i, --j);
if(i == cn->last) {
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 {
// The existing hostname is a suffix of this hostname.
// Continue matching at potion j.

View File

@ -96,9 +96,10 @@ void test_shrpx_ssl_create_lookup_tree(void)
}
SSL_CTX *ctxs2[] = {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]);
tree = ssl::cert_lookup_tree_new();
for(int i = 0; i < num; ++i) {