[Bps-public-commit] rt-authen-externalauth branch, net-ldaps-support, created. 0.09-14-g259044b

Kevin Falcone falcone at bestpractical.com
Mon Jan 23 12:36:57 EST 2012


The branch, net-ldaps-support has been created
        at  259044b99a3e526cbd94f579a19cbaf1de5f0241 (commit)

- Log -----------------------------------------------------------------
commit ba5d96cd1165cea17346110cc7c60f57a886ae45
Author: Guy Dickinson <guy at gdickinson.co.uk>
Date:   Fri Jan 6 16:47:48 2012 -0500

    Added the ability to use LDAPS via Net::LDAPS
    
    Dynamically load the correct module via a configuration option. Updated
    the example configuration to reflect the change and give some
    demonstration as to its usage.

diff --git a/Makefile.PL b/Makefile.PL
index 39d8c93..e40332e 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -11,6 +11,7 @@ readme_from;
 feature 'SSL LDAP Connections' =>
     -default => 0,
     recommends('Net::SSLeay' => 0),
+    recommends('Net::LDAPS' => 0),
     ;
 
 feature 'External LDAP Sources' => 
diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
index cf8ca36..be40035 100644
--- a/etc/RT_SiteConfig.pm
+++ b/etc/RT_SiteConfig.pm
@@ -98,6 +98,10 @@ Set($ExternalSettings,      {   # AN EXAMPLE DB SERVICE
                                                         # The server hosting the service
                                                         'server'                    =>  'server.domain.tld',
                                                         ## SERVICE-SPECIFIC SECTION
+                                                        #
+                                                        # If you need to use LDAPS (SSL rather than TLS),
+                                                        # set use_ldaps to 1;
+                                                        'use_ldaps'             => 0,
                                                         # If you can bind to your LDAP server anonymously you should 
                                                         # remove the user and pass config lines, otherwise specify them here:
                                                         # 
diff --git a/lib/RT/Authen/ExternalAuth/LDAP.pm b/lib/RT/Authen/ExternalAuth/LDAP.pm
index 885c7dd..8b76d17 100644
--- a/lib/RT/Authen/ExternalAuth/LDAP.pm
+++ b/lib/RT/Authen/ExternalAuth/LDAP.pm
@@ -3,6 +3,7 @@ package RT::Authen::ExternalAuth::LDAP;
 use Net::LDAP qw(LDAP_SUCCESS LDAP_PARTIAL_RESULTS);
 use Net::LDAP::Util qw(ldap_error_name);
 use Net::LDAP::Filter;
+use Net::LDAPS;
 
 use strict;
 
@@ -428,10 +429,18 @@ sub _GetBoundLdapObj {
     my $ldap_user       = $config->{'user'};
     my $ldap_pass       = $config->{'pass'};
     my $ldap_tls        = $config->{'tls'};
+    my $use_ldaps       = $config->{'use_ldaps'};
     my $ldap_ssl_ver    = $config->{'ssl_version'};
     my $ldap_args       = $config->{'net_ldap_args'};
     
-    my $ldap = new Net::LDAP($ldap_server, @$ldap_args);
+    my $ldap = 0;
+    if ($use_ldaps) {
+		$ldap = new Net::LDAPS($ldap_server, @$ldap_args);
+    }
+    else {
+		$ldap = new Net::LDAP($ldap_server, @$ldap_args);
+    }
+    
     
     unless ($ldap) {
         $RT::Logger->critical(  (caller(0))[3],

commit 12db36a217d16e5d5a5015662be3f0dd233c413a
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Jan 23 12:25:47 2012 -0500

    Remove literal tabs

diff --git a/lib/RT/Authen/ExternalAuth/LDAP.pm b/lib/RT/Authen/ExternalAuth/LDAP.pm
index 8b76d17..052ce57 100644
--- a/lib/RT/Authen/ExternalAuth/LDAP.pm
+++ b/lib/RT/Authen/ExternalAuth/LDAP.pm
@@ -435,10 +435,10 @@ sub _GetBoundLdapObj {
     
     my $ldap = 0;
     if ($use_ldaps) {
-		$ldap = new Net::LDAPS($ldap_server, @$ldap_args);
+        $ldap = new Net::LDAPS($ldap_server, @$ldap_args);
     }
     else {
-		$ldap = new Net::LDAP($ldap_server, @$ldap_args);
+        $ldap = new Net::LDAP($ldap_server, @$ldap_args);
     }
     
     

commit 259044b99a3e526cbd94f579a19cbaf1de5f0241
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Jan 23 12:36:37 2012 -0500

    Switch to dynamically loading Net::LDAPS when needed

diff --git a/lib/RT/Authen/ExternalAuth/LDAP.pm b/lib/RT/Authen/ExternalAuth/LDAP.pm
index 052ce57..6414a17 100644
--- a/lib/RT/Authen/ExternalAuth/LDAP.pm
+++ b/lib/RT/Authen/ExternalAuth/LDAP.pm
@@ -3,7 +3,6 @@ package RT::Authen::ExternalAuth::LDAP;
 use Net::LDAP qw(LDAP_SUCCESS LDAP_PARTIAL_RESULTS);
 use Net::LDAP::Util qw(ldap_error_name);
 use Net::LDAP::Filter;
-use Net::LDAPS;
 
 use strict;
 
@@ -435,10 +434,11 @@ sub _GetBoundLdapObj {
     
     my $ldap = 0;
     if ($use_ldaps) {
-        $ldap = new Net::LDAPS($ldap_server, @$ldap_args);
+        require Net::LDAPS;
+        $ldap = Net::LDAPS->new($ldap_server, @$ldap_args);
     }
     else {
-        $ldap = new Net::LDAP($ldap_server, @$ldap_args);
+        $ldap = Net::LDAP->new($ldap_server, @$ldap_args);
     }
     
     

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list