aboutsummaryrefslogtreecommitdiffstats
path: root/lib/DJabberd/Plugin/VCard
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DJabberd/Plugin/VCard')
-rw-r--r--lib/DJabberd/Plugin/VCard/LDAP.pm14
1 files changed, 13 insertions, 1 deletions
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
33 LDAPBindDN cn=reader 33 LDAPBindDN cn=reader
34 LDAPBindPW pass 34 LDAPBindPW pass
35 LDAPBaseDN ou=people 35 LDAPBaseDN ou=people
36 LDAPVersion 2
36 LDAPFilter (uid=%u) 37 LDAPFilter (uid=%u)
37 </Plugin> 38 </Plugin>
38 </VHost> 39 </VHost>
@@ -44,6 +45,9 @@ LDAPFilter is an LDAP filter substutions
44 - %u will be substituted with the incoming userid (w/o the domain) (ie. myuser) 45 - %u will be substituted with the incoming userid (w/o the domain) (ie. myuser)
45 - %d will be substituted with the incoming userid's domain (ie. mydoman.com) 46 - %d will be substituted with the incoming userid's domain (ie. mydoman.com)
46 47
48LDAPVersion is either 2 or 3, if nothing is specified then default to Net::LDAP default.
49This value is passed straight to Net::LDAP
50
47=cut 51=cut
48 52
49sub set_config_ldapuri { 53sub set_config_ldapuri {
@@ -53,6 +57,11 @@ sub set_config_ldapuri {
53 } 57 }
54} 58}
55 59
60sub set_config_ldapversion {
61 my ($self, $ldapversion) = @_;
62 $self->{'ldap_version'} = $ldapversion;
63}
64
56sub set_config_ldapbinddn { 65sub set_config_ldapbinddn {
57 my ($self, $ldapbinddn) = @_; 66 my ($self, $ldapbinddn) = @_;
58 $self->{'ldap_binddn'} = $ldapbinddn; 67 $self->{'ldap_binddn'} = $ldapbinddn;
@@ -79,8 +88,11 @@ sub finalize {
79 $logger->error_die("No LDAP BaseDN Specified") unless $self->{ldap_basedn}; 88 $logger->error_die("No LDAP BaseDN Specified") unless $self->{ldap_basedn};
80 $logger->error_die("Must specify filter with userid as %u") unless $self->{ldap_filter}; 89 $logger->error_die("Must specify filter with userid as %u") unless $self->{ldap_filter};
81 90
91 my %options;
92 $options{version} = $self->{ldap_version} if $self->{ldap_version};
93
82 # Initialize ldap connection 94 # Initialize ldap connection
83 $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}) 95 $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}, %options)
84 or $logger->error_die("Could not connect to LDAP Server ".$self->{ldap_uri}); 96 or $logger->error_die("Could not connect to LDAP Server ".$self->{ldap_uri});
85 97
86 if (defined $self->{'ldap_binddn'}) { 98 if (defined $self->{'ldap_binddn'}) {