ispman/lib http.lib,1.55,1.56

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20880/lib

Modified Files:
	http.lib 
Log Message:
fixes bug [ 942718 ] mod_auth_ldap.c in httpd 2.0.41
added new confVar "apacheAuthLdapModule"

Index: http.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/http.lib,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- http.lib	20 Jun 2004 12:46:28 -0000	1.55
+++ http.lib	27 Jun 2004 10:25:48 -0000	1.56
@@ -69,19 +69,19 @@
 
     $ispmanVhostServerAliases = $ispman->getAliases( $domain, $vhost );
     for ( keys %$ispmanVhostServerAliases ) {
-        my $alias=$ispmanVhostServerAliases->{$_}{'ispmanVhostServerAlias'};
+        my $alias = $ispmanVhostServerAliases->{$_}{'ispmanVhostServerAlias'};
 
         # Add the domain suffix to the alias for unqualified names
-        if ($alias !~ /\./){
+        if ( $alias !~ /\./ ) {
             push @_ispmanVhostServerAliases, join '.', ( $alias, $domain );
 
             # Add vhost aliases to all replica domains, too
             for my $_replica ( keys %$domainReplicas ) {
                 push @_ispmanVhostServerAliases, join '.',
-                (
-                 $ispmanVhostServerAliases->{$_}{'ispmanVhostServerAlias'},
-                 $_replica
-                 );
+                  (
+                    $ispmanVhostServerAliases->{$_}{'ispmanVhostServerAlias'},
+                    $_replica
+                  );
             }
         }
         else {
@@ -123,14 +123,15 @@
       [ keys %$_ispmanVhostDocumentRootOption ];
 
     $vhostHash->{$domain}{$vhost} = {
-        servername                    => "$vhost.$domain",
-        vhost                         => $vhost,
-        uidNumber                     => $vhostInfo->{'uidNumber'},
-        gidNumber                     => $vhostInfo->{'gidNumber'},
-        homeDirectory                 => $vhostInfo->{'homeDirectory'},
-        ispmanVhostServerAlias        => $vhostInfo->{'ispmanVhostServerAlias'},
-        ispmanVhostIpAddress          => $vhostInfo->{'ispmanVhostIpAddress'},
-        ispmanVhostExtraConf          => HTML::Entities::decode($vhostInfo->{'ispmanVhostExtraConf'}),
+        servername             => "$vhost.$domain",
+        vhost                  => $vhost,
+        uidNumber              => $vhostInfo->{'uidNumber'},
+        gidNumber              => $vhostInfo->{'gidNumber'},
+        homeDirectory          => $vhostInfo->{'homeDirectory'},
+        ispmanVhostServerAlias => $vhostInfo->{'ispmanVhostServerAlias'},
+        ispmanVhostIpAddress   => $vhostInfo->{'ispmanVhostIpAddress'},
+        ispmanVhostExtraConf   =>
+          HTML::Entities::decode( $vhostInfo->{'ispmanVhostExtraConf'} ),
         ispmanVhostDocumentRootOption =>
           $vhostInfo->{'ispmanVhostDocumentRootOption'},
         ispmanVhostScriptDirOption =>
@@ -347,41 +348,33 @@
             if ( $vhostHash->{$domain}{$vh}{'acls'} ) {
                 my $aclText = "";
                 for ( keys %{ $vhostHash->{$domain}{$vh}{'acls'} } ) {
-                    $aclText .= "<IfModule auth_ldap.c>\n";
-                    $aclText .=
-"<Location $vhostHash->{$domain}{$vh}{'acls'}{$_}{'ispmanVhostAclLocation'}>\n";
-                    $aclText .= "\tAuthType Basic\n\tAuthName $vh.$domain\n";
-                    $aclText .= "\tAuthLDAPURL ldap://";
-                    $aclText .= $ispman->getConf("ldapHost");
-                    $aclText .=
-"/ispmanDomain=$domain,@{[$ispman->getConf('ldapBaseDN')]}";
-                    $aclText .= "?ispmanUserId?sub?";
-                    if (
-                        ref $vhostHash->{$domain}{$vh}{'acls'}{$_}
-                        {'ispmanVhostAclAllowUser'} eq "ARRAY" )
+
+                    # build search filter
+                    my $filter = "(|";
+                    for $user (
+                        $ispman->as_array(
+                            $vhostHash->{$domain}{$vh}{'acls'}{$_}
+                              {'ispmanVhostAclAllowUser'}
+                        )
+                      )
                     {
-                        $aclText .= "(|";
-                        for $allow (
-                            @{
-                                $vhostHash->{$domain}{$vh}{'acls'}{$_}
-                                  {'ispmanVhostAclAllowUser'}
-                            }
-                          )
-                        {
-                            $aclText .= "(ispmanUserId=$allow)";
-                        }
-                        $aclText .= ")";
-                    }
-                    else {
-                        $aclText .=
-"(ispmanUserId=$vhostHash->{$domain}{$vh}{'acls'}{$_}{'ispmanVhostAclAllowUser'})";
+                        $filter .= "(ispmanUserId=$user)";
                     }
-                    $aclText .= "\n\trequire valid-user\n";
-                    $aclText .= "\t</Location>\n";
-                    $aclText .= "</IfModule>\n";
+                    $filter .= ")";
+
+                    # build vhost directives
+                    $aclText .= qq|
+\t<IfModule @{[$ispman->getConf("apacheAuthLdapModule")]}.c>
+\t\t<Location @{[$vhostHash->{$domain}{$vh}{'acls'}{$_}{'ispmanVhostAclLocation'}]}>
+\t\t\tAuthType Basic
+\t\t\tAuthName $vh.$domain
+\t\t\tAuthLDAPURL ldap://@{[$ispman->getConf("ldapHost")]}/ispmanDomain=$domain,@{[$ispman->getConf('ldapBaseDN')]}?ispmanUserId?sub?$filter
+\t\t\trequire valid-user
+\t\t</Location>
+\t</IfModule>
+|;
                 }
                 $vhostHash->{$domain}{$vh}{'acltext'} = $aclText;
-                print $vhostHash->{$domain}{$vh}{'acltext'};
             }
 
             ### ReDirects
@@ -409,6 +402,8 @@
               $ispman->{'Config'}{'ldapBaseDN'};
             $vhostHash->{$domain}{$vh}{'ldapHost'} =
               $ispman->{'Config'}{'ldapHost'};
+            $vhostHash->{$domain}{$vh}{'apacheAuthLdapModule'} =
+              $ispman->getConf("apacheAuthLdapModule");
 
             if ( $vhostHash->{$domain}{$vh}{'ispmanVhostStats'} eq "enable" ) {
                 $vhostHash->{$domain}{$vh}{'statalias'} =



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.