LDAP not connecting over IPv6

Quanah Gibson-Mount quanah at zimbra.com
Fri May 27 22:58:58 CEST 2011


--On Friday, May 27, 2011 1:55 PM -0700 Quanah Gibson-Mount 
<quanah at zimbra.com> wrote:

> --On Friday, May 27, 2011 10:09 AM +0200 Christian Roessner
> <c+amavis at roessner-network-solutions.com> wrote:
>
>> Am 27.05.2011 09:53, schrieb Christian Roessner:
>>> Hi,
>>>
>>> latest amavis-pre: LDAP ist not connected over IPv6:
>>>
>>> amavisd   2348   amavis   14u  IPv6   8676      0t0  TCP
>>> [2a01:4f8:131:1081:88:198:80:230]:50422->[2a01:4f8:61:8222:88:198:211:19
>>> ]:5432 (ESTABLISHED)
>>> amavisd   2348   amavis   15u  IPv4   8678      0t0  TCP
>>> 88.198.80.227:50414->88.198.211.19:389 (ESTABLISHED)
>>> amavisd   2348   amavis   16u  IPv6   8683      0t0  TCP
>>> [2a01:4f8:131:1081:88:198:80:230]:50424->[2a01:4f8:61:8222:88:198:211:19
>>> ]:5432 (ESTABLISHED)
>>>
>>> The postgresql database is connected over IPv6, but not LDAP. Both PgSQL
>>> and OpenLDAP are on the same host. The amavisd.conf uses
>>> db.roessner-net.de in both cases.
>>>
>>> Best wishes
>>> Christian
>>
>> Fixed with the following patch:
>>
>> --- amavisd-orig	2011-05-27 10:06:42.000000000 +0200
>> +++ amavisd	2011-05-27 10:07:24.000000000 +0200
>> @@ -16994,6 +16994,7 @@
>>                              port    => $self->{port},
>>                              version => $self->{version},
>>                              timeout => $self->{timeout},
>> +			    inet6   => 'Y',
>>                              );
>>    if (!$ldap) {  # connect failed
>>      do_log(-1,"connect_to_ldap: unable to connect to host %s",
>> $hostlist);
>
> Wouldn't it be better to use the "$have_inet6" variable to if def this?


Something like (not tested):

--- //depot/zimbra/main/ThirdParty/amavisd/amavisd-new-2.7.0-rc1/amavisd 
2011-05-19 18:43:08.000000000 -0700
+++ /home/quanah/p4/main/ThirdParty/amavisd/amavisd-new-2.7.0-rc1/amavisd 
2011-05-19 18:43:08.000000000 -0700
@@ -16971,10 +16971,15 @@
   my $hostlist = ref $self->{hostname} eq 'ARRAY' ?
                      join(", ",@{$self->{hostname}}) : $self->{hostname};
   do_log(4,"connect_to_ldap: trying %s", $hostlist);
+  my $ldap_inet = 'N';
+  if ($Amavis::IO::RW::have_inet6) {
+    $ldap_inet = 'Y';
+  }
   my $ldap = Net::LDAP->new($self->{hostname},
                             port    => $self->{port},
                             version => $self->{version},
                             timeout => $self->{timeout},
+                            inet6 => $ldap_inet,
                             );
   if (!$ldap) {  # connect failed
     do_log(-1,"connect_to_ldap: unable to connect to host %s", $hostlist);



--

Quanah Gibson-Mount
Sr. Member of Technical Staff
Zimbra, Inc
A Division of VMware, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration


More information about the amavis-users mailing list