diff options
author | Edward Rudd | 2010-02-15 13:48:35 -0500 |
---|---|---|
committer | Edward Rudd | 2010-02-15 13:48:35 -0500 |
commit | 869bff550c6b5b60d8d1dfa6749fd3dbe47d914f (patch) | |
tree | adc92c8e710f14039895ef5354c4cf1df991df3b | |
parent | aa52e15abc8ed61839866c0e5b65e725c690cccb (diff) |
Add support to specify LDAP version (rt #54101)
-rw-r--r-- | lib/DJabberd/Authen/LDAP.pm | 15 |
1 files changed, 14 insertions, 1 deletions
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'; | |||
35 | LDAPBindPW pass | 35 | LDAPBindPW pass |
36 | LDAPBaseDN ou=people | 36 | LDAPBaseDN ou=people |
37 | LDAPFilter (&(inetAuthorizedServices=jabber)(uid=%u)) | 37 | LDAPFilter (&(inetAuthorizedServices=jabber)(uid=%u)) |
38 | LDAPVersion 2 | ||
38 | LDAPMethod rebind | 39 | LDAPMethod rebind |
39 | </Plugin> | 40 | </Plugin> |
40 | </VHost> | 41 | </VHost> |
@@ -50,6 +51,9 @@ LDAPFilter is an LDAP filter substutions | |||
50 | - %u will be substituted with the incoming userid (w/o the domain) (ie. myuser) | 51 | - %u will be substituted with the incoming userid (w/o the domain) (ie. myuser) |
51 | - %d will be substituted with the incoming userid's domain (ie. mydoman.com) | 52 | - %d will be substituted with the incoming userid's domain (ie. mydoman.com) |
52 | 53 | ||
54 | LDAPVersion is either 2 or 3, if nothing is specified then default to Net::LDAP default. | ||
55 | This value is passed straight to Net::LDAP | ||
56 | |||
53 | =head1 AUTHOR | 57 | =head1 AUTHOR |
54 | 58 | ||
55 | Edward Rudd, C<< <urkle at outoforder.cc> >> | 59 | Edward Rudd, C<< <urkle at outoforder.cc> >> |
@@ -83,6 +87,11 @@ sub set_config_ldapfilter { | |||
83 | $self->{'ldap_filter'} = $ldapfilter; | 87 | $self->{'ldap_filter'} = $ldapfilter; |
84 | } | 88 | } |
85 | 89 | ||
90 | sub set_config_ldapversion { | ||
91 | my ($self, $ldapversion) = @_; | ||
92 | $self->{'ldap_version'} = $ldapversion; | ||
93 | } | ||
94 | |||
86 | sub set_config_ldapmethod { | 95 | sub set_config_ldapmethod { |
87 | my ($self, $ldapmethod) = @_; | 96 | my ($self, $ldapmethod) = @_; |
88 | if ( $ldapmethod =~ /^(?:rebind)$/ ) { | 97 | if ( $ldapmethod =~ /^(?:rebind)$/ ) { |
@@ -105,8 +114,12 @@ sub finalize { | |||
105 | $logger->error_die("Invalid LDAP Authentication Method"); | 114 | $logger->error_die("Invalid LDAP Authentication Method"); |
106 | } | 115 | } |
107 | } | 116 | } |
117 | |||
118 | my %options; | ||
119 | $options{version} = $self->{ldap_version} if $self->{ldap_version}; | ||
120 | |||
108 | # Initialize ldap connection | 121 | # Initialize ldap connection |
109 | $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}) | 122 | $self->{'ldap_conn'} = Net::LDAP->new($self->{ldap_uri}, %options) |
110 | or $logger->error_die("Could not connect to LDAP Server ".$self->{ldap_uri}); | 123 | or $logger->error_die("Could not connect to LDAP Server ".$self->{ldap_uri}); |
111 | } | 124 | } |
112 | 125 | ||