Subject: Developers of Sympa
List archive
- From: Vincent MATHIEU <address@concealed>
- To: address@concealed
- Subject: replica LDAP
- Date: Mon, 04 Feb 2002 09:59:21 +0100
The replica support in sympa is'nt complete.
In particular, the lists ldap (include_ldap_query) doesn't support this mecanism.
The module perl perl-ldap developer, Graham Barr, forwarded to me a patch (multi_host1.pat), to apply to version 0.25 of Perl-ldap, which makes it possible this module to support replica LDAP. This patch should be applied to the next version of Perl-ldap.
The call to method new is unchanged :
Net::LDAP->new($host, options....)
Now, the parameter host can be a hostname (for example, univ.fr), or the reference of a table containing hostnames.
for example :
$host = "univ.fr:395,univ.fr:392";
my @hostlist = split(/,/, $host);
$ldap = Net::LDAP->new($h);
the file List.pm.diff contains the modifications so that sympa supports the réplica in lists LDAP.
the file Ldap.pm contains the modifications to be applied so that all calls LDAP from sympa supports the replica.
--
Vincent
MATHIEU
CRI - Universite NANCY
2 |
Email : address@concealed
Pole Lorrain de
Gestion
| Tel : (33) 03.83.39.64.06
13, Rue Michel Ney - C.O. 75 |
Fax : (33) 03.83.39.64.43
54013 Nancy Cedex. FRANCE
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP.pm,v
retrieving revision 1.28
diff -u -u -r1.28 LDAP.pm
--- lib/Net/LDAP.pm 2001/10/29 17:29:15 1.28
+++ lib/Net/LDAP.pm 2002/01/31 13:22:56
@@ -22,7 +22,7 @@
LDAP_INAPPROPRIATE_AUTH
);
-$VERSION = 0.25;
+$VERSION = "0.25_01";
@ISA = qw(Net::LDAP::Extra);
$LDAP_VERSION = 2; # default LDAP protocol version
@@ -98,7 +98,6 @@
$obj->_connect($host, $arg) or return;
- $obj->{net_ldap_host} = $host;
$obj->{net_ldap_resp} = {};
$obj->{net_ldap_version} = $arg->{version} || $LDAP_VERSION;
$obj->{net_ldap_async} = $arg->{async} ? 1 : 0;
@@ -116,14 +115,19 @@
sub _connect {
my ($ldap, $host, $arg) = @_;
- $ldap->{net_ldap_socket} = IO::Socket::INET->new(
- PeerAddr => $host,
- PeerPort => $arg->{port} || '389',
- Proto => 'tcp',
- Timeout => defined $arg->{timeout}
- ? $arg->{timeout}
- : 120
- );
+ foreach my $h (ref($host) ? @$host : ($host)) {
+ $ldap->{net_ldap_socket} = IO::Socket::INET->new(
+ PeerAddr => $h,
+ PeerPort => $arg->{port} || '389',
+ Proto => 'tcp',
+ Timeout => defined $arg->{timeout}
+ ? $arg->{timeout}
+ : 120
+ ) or next;
+ $ldap->{net_ldap_host} = $h;
+ return 1;
+ }
+ return 0;
}
sub message {
219a220
> 'host_ldap' => '[\w\.\-:,]+',
470c471
< 'include_ldap_query' => {'format' => {'host' => {'format' =>
$regexp{'host'},
---
> 'include_ldap_query' => {'format' => {'host' => {'format' =>
> $regexp{'host_ldap'},
527c528
< 'include_ldap_2level_query' => {'format' => {'host' => {'format'
=> $regexp{'host'},
---
> 'include_ldap_2level_query' => {'format' => {'host' => {'format'
> => $regexp{'host_ldap'},
4106c4107
< $filter =~ s/\[sender\]/$sender/;
---
> $filter =~ s/\[sender\]/$sender/g;
4908c4909,4912
< unless ($ldaph = Net::LDAP->new($host, port => "$port", timeout =>
$param->{'timeout'})) {
---
> my (@hostlist) = split(/,/, $host);
> my $h = $hostlist[1] ? \@hostlist : $host; # pointeur de tableau, ou
> chaine
>
> unless ($ldaph = Net::LDAP->new($h, port => "$port", timeout =>
> $param->{'timeout'})) {
5022c5026,5029
< unless ($ldaph = Net::LDAP->new($host, port => "$port", timeout =>
$param->{'timeout'})) {
---
> my (@hostlist) = split(/,/, $host);
> my $h = $hostlist[1] ? \@hostlist : $host; # pointeur de tableau, ou
> chaine
>
> unless ($ldaph = Net::LDAP->new($h, port => "$port", timeout =>
> $param->{'timeout'})) {
122c122,124
< my $ldap = Net::LDAP->new($Conf{'ldap_export'}{$directory}{'host'});
---
> my (@hostlist) = split(/,/,$Conf{'ldap_export'}{$directory}{'host'});
> my $h = $hostlist[1] ? \@hostlist :
> $Conf{'ldap_export'}{$directory}{'host'};
> my $ldap = Net::LDAP->new($h);
205c207,209
< $ldap = Net::LDAP->new($Conf{'ldap_export'}{$directory}{'host'});
---
> my (@hostlist) = split(/,/, $Conf{'ldap_export'}{$directory}{'host'});
> my $h = $hostlist[1] ? \@hostlist :
> $Conf{'ldap_export'}{$directory}{'host'}; # pointeur de tableau, ou
> chaine
> $ldap = Net::LDAP->new($h);
262c266,269
< my $ldap = Net::LDAP->new($Conf{'ldap_export'}{$directory}{'host'},
timeout => $Conf{'ldap_export'}{$directory}{'connection_timeout'});
---
> my (@hostlist) = split(/,/, $Conf{'ldap_export'}{$directory}{'host'});
> my $h = $hostlist[1] ? \@hostlist :
> $Conf{'ldap_export'}{$directory}{'host'}; # pointeur de tableau, ou
> chaine
>
> my $ldap = Net::LDAP->new($h, timeout =>
> $Conf{'ldap_export'}{$directory}{'connection_timeout'});
313c320,323
< my $ldap = Net::LDAP->new($datas->{'host'},timeout =>
$datas->{'timeout'});
---
> my (@hostlist) = split(/,/, $datas->{'host'});
> my $h = $hostlist[1] ? \@hostlist : $datas->{'host'}; # pointeur de
> tableau, ou chaine
>
> my $ldap = Net::LDAP->new($h ,timeout => $datas->{'timeout'});
- replica LDAP, Vincent MATHIEU, 02/04/2002
Archive powered by MHonArc 2.6.19+.