From 869bff550c6b5b60d8d1dfa6749fd3dbe47d914f Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Mon, 15 Feb 2010 18:48:35 +0000 Subject: Add support to specify LDAP version (rt #54101) --- (limited to 'lib') diff --git a/lib/DJabberd/Authen/LDAP.pm b/lib/DJabberd/Authen/LDAP.pm index fdfa105..6f7233d 100644 --- a/lib/DJabberd/Authen/LDAP.pm +++ b/lib/DJabberd/Authen/LDAP.pm @@ -35,6 +35,7 @@ our $VERSION = '0.02'; LDAPBindPW pass LDAPBaseDN ou=people LDAPFilter (&(inetAuthorizedServices=jabber)(uid=%u)) + LDAPVersion 2 LDAPMethod rebind @@ -50,6 +51,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 + =head1 AUTHOR Edward Rudd, C<< >> @@ -83,6 +87,11 @@ sub set_config_ldapfilter { $self->{'ldap_filter'} = $ldapfilter; } +sub set_config_ldapversion { + my ($self, $ldapversion) = @_; + $self->{'ldap_version'} = $ldapversion; +} + sub set_config_ldapmethod { my ($self, $ldapmethod) = @_; if ( $ldapmethod =~ /^(?:rebind)$/ ) { @@ -105,8 +114,12 @@ sub finalize { $logger->error_die("Invalid LDAP Authentication Method"); } } + + 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}); } -- cgit v0.9.2