Changeset 1823 for trunk/server/common


Ignore:
Timestamp:
Apr 29, 2011, 9:15:02 PM (13 years ago)
Author:
andersk
Message:
ldapize: Support wildcard vhosts

As a side effect, this magically gives us useful error messages for
unknown vhosts (Trac: #166).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/execsys/ldapize.pl

    r1822 r1823  
    1111my $mesg;
    1212
     13my $vhostName = $hostname;
     14
     15vhost:
    1316# oh my gosh Net::LDAP::Filter SUCKS
    1417my $filter = bless({and =>
     
    1720     {or =>
    1821         [{equalityMatch => {attributeDesc  => 'scriptsVhostName',
    19                              assertionValue => $hostname}},
     22                             assertionValue => $vhostName}},
    2023          {equalityMatch => {attributeDesc  => 'scriptsVhostAlias',
    21                              assertionValue => $hostname}}]}]},
     24                             assertionValue => $vhostName}}]}]},
    2225    'Net::LDAP::Filter');
    2326
     
    3134
    3235my $vhostEntry = $mesg->pop_entry;
     36if (!defined $vhostEntry) {
     37  $vhostName ne '*' or die 'No vhost for *';
     38  $vhostName =~ s/^(?:\*\.)?[^.]*/*/;  # Try next wildcard
     39  goto vhost;
     40}
     41
    3342my $vhostDirectory = $vhostEntry->get_value('scriptsVhostDirectory');
    3443
Note: See TracChangeset for help on using the changeset viewer.