Changeset 680 for server/common/oursrc


Ignore:
Timestamp:
Mar 7, 2008, 6:16:20 AM (17 years ago)
Author:
andersk
Message:
Simplify construction of wildcard hostnames.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/common/oursrc/httpdmods/mod_vhost_ldap.c

    r679 r680  
    508508
    509509    if ((result == LDAP_NO_SUCH_OBJECT)) {
    510         char* parent_hostname = apr_pstrdup(r->pool, hostname);
    511         do {
    512             parent_hostname = strchr(parent_hostname + 1, '.');
    513         } while (parent_hostname && parent_hostname[-1] != '*');
    514         if (parent_hostname) {
    515             *(--parent_hostname) = '*';
     510        if (strcmp(hostname, "*") != 0) {
     511            if (strncmp(hostname, "*.", 2) == 0)
     512                hostname += 2;
     513            hostname += strcspn(hostname, ".");
     514            hostname = apr_pstrcat(r->pool, "*", hostname, NULL);
    516515            ap_log_rerror(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0, r,
    517516                          "[mod_vhost_ldap.c] translate: "
    518517                          "virtual host not found, trying wildcard %s",
    519                           parent_hostname);
    520             hostname = parent_hostname;
     518                          hostname);
    521519            goto fallback;
    522520        }
Note: See TracChangeset for help on using the changeset viewer.