From 3b083487e27731a190299f3fd24c20a95ec89e36 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Mon, 15 Feb 2010 14:49:28 -0500 Subject: add ability to set LDAP version --- lib/DJabberd/Plugin/VCard/LDAP.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/DJabberd/Plugin/VCard/LDAP.pm b/lib/DJabberd/Plugin/VCard/LDAP.pm index 1ecebb7..f3578b4 100644 --- a/lib/DJabberd/Plugin/VCard/LDAP.pm +++ b/lib/DJabberd/Plugin/VCard/LDAP.pm @@ -33,6 +33,7 @@ Provides an LDAP VCard backend for DJabberd LDAPBindDN cn=reader LDAPBindPW pass LDAPBaseDN ou=people + LDAPVersion 2 LDAPFilter (uid=%u) @@ -44,6 +45,9 @@ LDAPFilter is an LDAP filter substutions - %u will be substituted with the incoming userid (w/o the domain) (ie. myuser) - %d will be substituted with the incoming userid's domain (ie. mydoman.com) +LDAPVersion is either 2 or 3, if nothing is specified then default to Net::LDAP default. +This value is passed straight to Net::LDAP + =cut sub set_config_ldapuri { @@ -53,6 +57,11 @@ sub set_config_ldapuri { } } +sub set_config_ldapversion { + my ($self, $ldapversion) = @_; + $self->{'ldap_version'} = $ldapversion; +} + sub set_config_ldapbinddn { my ($self, $ldapbinddn) = @_; $self->{'ldap_binddn'} = $ldapbinddn; @@ -79,8 +88,11 @@ sub finalize { $logger->error_die("No LDAP BaseDN Specified") unless $self->{ldap_basedn}; $logger->error_die("Must specify filter with userid as %u") unless $self->{ldap_filter}; + my %options; + $options{version} = $self->{ldap_version} if $self->{ldap_version}; + # Initialize ldap connection - $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}) + $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}, %options) or $logger->error_die("Could not connect to LDAP Server ".$self->{ldap_uri}); if (defined $self->{'ldap_binddn'}) { -- cgit