]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 282687: LDAP: TLS Support - Patch by guillomovitch@zarb.org r=mkanat a=justdave
authorlpsolit%gmail.com <>
Fri, 2 Jun 2006 18:52:48 +0000 (18:52 +0000)
committerlpsolit%gmail.com <>
Fri, 2 Jun 2006 18:52:48 +0000 (18:52 +0000)
Bugzilla/Auth/Verify/LDAP.pm
Bugzilla/Config/LDAP.pm
template/en/default/admin/params/ldap.html.tmpl
template/en/default/global/code-error.html.tmpl

index dccfa0b7c2bae1baae8d7eac1b369b25265fbc32..2ee5247ec5e015505f9582e80127980cfb057a69 100644 (file)
@@ -164,6 +164,14 @@ sub ldap {
     my $conn_string = "$protocol://$server:$port";
     $self->{ldap} = new Net::LDAP($conn_string) 
         || ThrowCodeError("ldap_connect_failed", { server => $conn_string });
+
+    # try to start TLS if needed
+    if (Param("LDAPstarttls")) {
+        my $mesg = $self->{ldap}->start_tls();
+        ThrowCodeError("ldap_start_tls_failed", { error => $mesg->error() })
+            if $mesg->code();
+    }
+
     return $self->{ldap};
 }
 
index 3f123243b1b2faa614f78ad7b5c5c51d37f249b3..a9b46382e3f3da281612f9e24fb5d6599d024699 100644 (file)
@@ -46,6 +46,12 @@ sub get_param_list {
    default => ''
   },
 
+  {
+   name => 'LDAPstarttls',
+   type => 'b',
+   default => 0
+  },
+
   {
    name => 'LDAPbinddn',
    type => 't',
index 0490aa675815823dddfe71d61de3db0da7245f0c..aef2713b108016a2d5ee0612ce496f7c642d5d71 100644 (file)
@@ -29,6 +29,9 @@
                 "(e.g. ldap.company.com, or ldap.company.com:portnum). " _
                 "Can be prefixed with ldap:// (default) or ldaps:// (for a secure connection).",
 
+  LDAPstartls => "Whether to require encrypted communication once normal " _
+                 "LDAP connection achieved with the server.",
+
   LDAPbinddn => "If your LDAP server requires that you use a binddn and password " _
                 "instead of binding anonymously, enter it here " _
                 "(e.g. cn=default,cn=user:password). " _
index a836297136388edc633fb75165b886a4b4d12744..0ec46461f8524c132bd2a927f9d99e68f33168f1 100644 (file)
   [% ELSIF error == "ldap_connect_failed" %]
     Could not connect to the LDAP server <code>[% server FILTER html %]</code>.
 
+  [% ELSIF error == "ldap_start_tls_failed" %]
+    Could not start TLS with LDAP server: <code>[% error FILTER html %]</code>.
+
   [% ELSIF error == "ldap_search_error" %]
     An error occurred while trying to search LDAP for 
     &quot;[% username FILTER html %]&quot;: