Changeset 14d718f in mod_gnutls
- Timestamp:
- Nov 11, 2012, 4:04:15 PM (10 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, master, msva, proxy-ticket, upstream
- Children:
- 9ddaa29
- Parents:
- 9ee0464
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gnutls_hooks.c
r9ee0464 r14d718f 509 509 } vhost_cb_rec; 510 510 511 /** 512 * Matches the current vhost's ServerAlias directives 513 * 514 * @param x vhost callback record 515 * @param s server record 516 * @return true if a match, false otherwise 517 * 518 */ 519 int check_server_aliases(vhost_cb_rec *x, server_rec * s, mgs_srvconf_rec *tsc) { 520 apr_array_header_t *names; 521 int i,rv = 0; 522 523 /* Check ServerName First! */ 524 if(apr_strnatcasecmp(x->sni_name, s->server_hostname) == 0) { 525 // We have a match, save this server configuration 526 x->sc = tsc; 527 rv = 1; 528 /* Check any ServerAlias directives */ 529 } else if(s->names) { 530 names = s->names; 531 char **name = (char **)names->elts; 532 for (i = 0; i < names->nelts; ++i) { 533 if (!name[i]) { continue; } 534 if (apr_strnatcasecmp(x->sni_name, name[i]) == 0) { 535 // We have a match, save this server configuration 536 x->sc = tsc; 537 rv = 1; 538 } 539 } 540 /* Wild any ServerAlias Directives */ 541 } else if(s->wild_names) { 542 names = s->wild_names; 543 char **name = (char **)names->elts; 544 for (i = 0; i < names->nelts; ++i) { 545 if (!name[i]) { continue; } 546 if(apr_fnmatch(name[i], x->sni_name , 547 APR_FNM_CASE_BLIND| 548 APR_FNM_PERIOD| 549 APR_FNM_PATHNAME| 550 APR_FNM_NOESCAPE) == APR_SUCCESS) { 551 x->sc = tsc; 552 rv = 1; 553 } 554 } 555 } 556 return rv; 557 } 558 511 559 static int vhost_cb(void *baton, conn_rec * conn, server_rec * s) { 512 560 mgs_srvconf_rec *tsc; 513 561 vhost_cb_rec *x = baton; 514 apr_array_header_t *names;515 int i;516 562 517 563 _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); … … 523 569 } 524 570 525 /* Check ServerName First! */ 526 if(!apr_strnatcasecmp(x->sni_name, s->server_hostname)) { 527 x->sc = tsc;return 1; 528 } else if(s->names) { 529 /* ServerAlias Directives */ 530 names = s->names; 531 char **name = (char **)names->elts; 532 for (i = 0; i < names->nelts; ++i) { 533 if (!name[i]) { continue; } 534 if (!apr_strnatcasecmp(x->sni_name, name[i])) { 535 x->sc = tsc;return 1; } 536 } 537 } else if(s->wild_names) { 538 /* Wild ServerAlias Directives */ 539 names = s->wild_names; 540 char **name = (char **)names->elts; 541 for (i = 0; i < names->nelts; ++i) { 542 if (!name[i]) { continue; } 543 if (!ap_strcasecmp_match(x->sni_name, name[i])) { 544 x->sc = tsc;return 1; } 545 } 546 } 547 548 return 0; 571 return check_server_aliases(x, s, tsc); 549 572 } 550 573 #endif … … 604 627 605 628 if (tsc->enabled != GNUTLS_ENABLED_TRUE) { continue; } 606 607 /* Check ServerName First! */ 608 if(!apr_strnatcasecmp(sni_name, s->server_hostname)) { 609 return tsc; 610 } else if(s->names) { 611 /* ServerAlias Directives */ 612 names = s->names; 613 char **name = (char **)names->elts; 614 for (i = 0; i < names->nelts; ++i) { 615 if (!name[i]) { continue; } 616 if (!apr_strnatcasecmp(sni_name, name[i])) { 617 return tsc; } 618 } 619 } else if(s->wild_names) { 620 /* Wild ServerAlias Directives */ 621 names = s->wild_names; 622 char **name = (char **)names->elts; 623 for (i = 0; i < names->nelts; ++i) { 624 if (!name[i]) { continue; } 625 if (!ap_strcasecmp_match(sni_name, name[i])) { 626 return tsc; } 627 } 628 } /* End Wild Names*/ 629 } /* End For Loop */ 629 630 if(check_server_aliases(x, s, tsc)) { 631 return tsc; 632 } 630 633 #endif 631 634 return NULL;
Note: See TracChangeset
for help on using the changeset viewer.