LDAP connection types (was Re: LDAP not connecting over IPv6)

Mark Martinec Mark.Martinec+amavis at ijs.si
Wed Jun 1 01:45:32 CEST 2011


> Yeah, I was thinking about this part of the patch:
> +  if (!defined $self->{scheme}) {
> +    $self->{scheme} = $self->{hostname} =~ /^ldaps/i ? 'ldaps' : 'ldap';
> +  }
> since hostname could have "ldapi" in it, as per the Net::LDAP
> documentation.  This would change the method to "ldap" instead, which would
> be wrong.
> new ( HOST, OPTIONS )
> Creates a new Net::LDAP object and opens a connection to the named host.
> HOST may be a host name or an IP number. TCP port may be specified
> after the host name followed by a colon (such as localhost:10389). The
> default TCP port for LDAP is 389.
> You can also specify a URI, such as 'ldaps://' or
> 'ldapi://%2fvar%2flib%2fldap_sock'. Note that '%2f's in the LDAPI socket
> path will be translated into '/'. This is to support LDAP query options
> like base, search etc. although the query part of the URI will be ignored
> in this context. If port was not specified in the URI, the default is
> either 389 or 636 for 'LDAP' and 'LDAPS' schemes respectively.

So perhaps it would be better to just leave out any guesswork on
determining a default 'scheme' and 'port' attributes, leave them at
undef if a user did not specify these explicitly, and let Net::LDAP
module provide a default for both.


More information about the amavis-users mailing list