From: Tomas K. <to...@us...> - 2005-03-27 09:20:28
|
Update of /cvsroot/squirrelmail/squirrelmail/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30099 Modified Files: conf.pl Log Message: adding limit_scope and filter support to ldap configuration Index: conf.pl =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/config/conf.pl,v retrieving revision 1.207 retrieving revision 1.208 diff -u -w -r1.207 -r1.208 --- conf.pl 20 Mar 2005 10:29:45 -0000 1.207 +++ conf.pl 27 Mar 2005 09:20:11 -0000 1.208 @@ -232,6 +232,11 @@ $tmp =~ s/[\'\"]?,?\s*$//; $tmp =~ s/[\'\"]?\);\s*$//; $maxrows = $tmp; + } elsif ( $tmp =~ /^\s*[\'\"]filter[\'\"]/i ) { + $tmp =~ s/^\s*[\'\"]filter[\'\"]\s*=>\s*[\'\"]?//i; + $tmp =~ s/[\'\"]?,?\s*$//; + $tmp =~ s/[\'\"]?\);\s*$//; + $filter = $tmp; } elsif ( $tmp =~ /^\s*[\'\"]name[\'\"]/i ) { $tmp =~ s/^\s*[\'\"]name[\'\"]\s*=>\s*[\'\"]//i; $tmp =~ s/[\'\"],?\s*$//; @@ -252,6 +257,11 @@ $tmp =~ s/[\'\"]?,?\s*$//; $tmp =~ s/[\'\"]?\);\s*$//; $protocol = $tmp; + } elsif ( $tmp =~ /^\s*[\'\"]limit_scope[\'\"]/i ) { + $tmp =~ s/^\s*[\'\"]limit_scope[\'\"]\s*=>\s*[\'\"]?//i; + $tmp =~ s/[\'\"]?,?\s*$//; + $tmp =~ s/[\'\"]?\);\s*$//; + $limit_scope = $tmp; } } $ldap_host[$sub] = $host; @@ -259,10 +269,12 @@ $ldap_name[$sub] = $name; $ldap_port[$sub] = $port; $ldap_maxrows[$sub] = $maxrows; + $ldap_filter[$sub] = $filter; $ldap_charset[$sub] = $charset; $ldap_binddn[$sub] = $binddn; $ldap_bindpw[$sub] = $bindpw; $ldap_protocol[$sub] = $protocol; + $ldap_limit_scope[$sub] = $limit_scope; } elsif ( $options[0] =~ /^(data_dir|attachment_dir|theme_css|org_logo|signout_page)$/ ) { ${ $options[0] } = &change_to_rel_path($options[1]); } else { @@ -2399,6 +2411,9 @@ if ( $ldap_maxrows[$count] ) { print " maxrows: $ldap_maxrows[$count]\n"; } + if ( $ldap_filter[$count] ) { + print " filter: $ldap_filter[$count]\n"; + } if ( $ldap_binddn[$count] ) { print " binddn: $ldap_binddn[$count]\n"; if ( $ldap_bindpw[$count] ) { @@ -2408,6 +2423,9 @@ if ( $ldap_protocol[$count] ) { print " protocol: $ldap_protocol[$count]\n"; } + if ( $ldap_limit_scope[$count] ) { + print " limit_scope: $ldap_limit_scope[$count]\n"; + } print "\n"; $count++; @@ -2470,6 +2488,16 @@ print "\n"; + print "You can specify an additional search filter.\n"; + print "This could be something like \"(objectclass=posixAccount)\".\n"; + print "Default is no extra filter. Press ENTER for default.\n"; + print "filter: "; + $name = <STDIN>; + $name =~ s/[\r|\n]//g; + $ldap_filter[$sub] = $name; + + print "\n"; + print "If your LDAP server does not like anonymous logins, you can specify bind DN.\n"; print "Default is none, anonymous bind. Press ENTER for default.\n"; print "binddn: "; @@ -2500,6 +2528,22 @@ print "\n"; + print "You can control search scope here.\n"; + print "This option is specific to Microsoft ADS implementation.\n"; + print "It requires use of v3 or newer LDAP protocol.\n"; + print "Don't enable it, if you use other LDAP server.\n"; + print "\n"; + print "Limit ldap scope? (y/N):"; + $name = <STDIN>; + if ( $name =~ /^y\n/i ) { + $name = 'true'; + } else { + $name = 'false'; + } + $ldap_limit_scope[$sub] = $name; + + print "\n"; + } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) { if ( $input =~ /[0-9]+\s*$/ ) { $rem_num = $input; @@ -2515,9 +2559,11 @@ @new_ldap_name = (); @new_ldap_charset = (); @new_ldap_maxrows = (); + @new_ldap_filter = (); @new_ldap_bindpw = (); @new_ldap_binddn = (); @new_ldap_protocol = (); + @new_ldap_limit_scope = (); while ( $count <= $#ldap_host ) { if ( $count != $rem_num ) { @@ -2527,9 +2573,11 @@ @new_ldap_name = ( @new_ldap_name, $ldap_name[$count] ); @new_ldap_charset = ( @new_ldap_charset, $ldap_charset[$count] ); @new_ldap_maxrows = ( @new_ldap_maxrows, $ldap_maxrows[$count] ); + @new_ldap_filter = ( @new_ldap_filter, $ldap_filter[$count] ); @new_ldap_binddn = ( @new_ldap_binddn, $ldap_binddn[$count] ); @new_ldap_bindpw = ( @new_ldap_bindpw, $ldap_bindpw[$count] ); @new_ldap_protocol = ( @new_ldap_protocol, $ldap_protocol[$count] ); + @new_ldap_limit_scope = ( @new_ldap_limit_scope, $ldap_limit_scope[$count] ); } $count++; } @@ -2539,9 +2587,11 @@ @ldap_name = @new_ldap_name; @ldap_charset = @new_ldap_charset; @ldap_maxrows = @new_ldap_maxrows; + @ldap_filter = @new_ldap_filter; @ldap_binddn = @new_ldap_binddn; @ldap_bindpw = @new_ldap_bindpw; @ldap_protocol = @new_ldap_protocol; + @ldap_limit_scope = @new_ldap_limit_scope; } elsif ( $input =~ /^\s*\?\s*/ ) { print ".-------------------------.\n"; @@ -3323,6 +3373,11 @@ # integer print CF " 'maxrows' => $ldap_maxrows[$count]"; } + # string + if ( $ldap_filter[$count] ) { + print CF ",\n"; + print CF " 'filter' => '$ldap_filter[$count]'"; + } if ( $ldap_binddn[$count] ) { print CF ",\n"; # string @@ -3338,6 +3393,11 @@ # integer print CF " 'protocol' => $ldap_protocol[$count]"; } + if ( $ldap_limit_scope[$count] ) { + print CF ",\n"; + # boolean + print CF " 'limit_scope' => $ldap_limit_scope[$count]"; + } print CF "\n"; print CF ");\n"; print CF "\n"; |