]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Patch for bug 216902: support LDAPS connections; patch by Christian Krause <chkr...
authorjocuri%softhome.net <>
Sat, 4 Mar 2006 20:08:31 +0000 (20:08 +0000)
committerjocuri%softhome.net <>
Sat, 4 Mar 2006 20:08:31 +0000 (20:08 +0000)
Bugzilla/Auth/Verify/LDAP.pm
template/en/default/admin/params/ldap.html.tmpl

index e8e7449714d2d24b1c6f1ca133a86ed1b79a1d60..376fac71db9a169ea075d578a9ffd7942a8fd57e 100644 (file)
@@ -73,10 +73,29 @@ sub authenticate {
     }
 
     my $LDAPport = "389";  # default LDAP port
-    if($LDAPserver =~ /:/) {
-        ($LDAPserver, $LDAPport) = split(":",$LDAPserver);
+    my $LDAPprotocol = "ldap";
+
+    if ($LDAPserver =~ /(ldap|ldaps):\/\/(.*)/) {
+        # ldap(s)://server(:port)
+        $LDAPprotocol = $1;
+        my $serverpart = $2;
+        if ($serverpart =~ /:/) {
+            # ldap(s)://server:port
+            ($LDAPserver, $LDAPport) = split(":", $serverpart);
+        } else {
+            # ldap(s)://server
+            $LDAPserver = $serverpart;
+            if ($LDAPprotocol eq "ldaps") {
+                $LDAPport = "636";
+            }
+        }
+    } elsif ($LDAPserver =~ /:/) {
+        # server:port
+        ($LDAPserver, $LDAPport) = split(":", $LDAPserver);
     }
-    my $LDAPconn = Net::LDAP->new($LDAPserver, port => $LDAPport, version => 3);
+
+
+    my $LDAPconn = Net::LDAP->new("$LDAPprotocol://$LDAPserver:$LDAPport", version => 3);
     if(!$LDAPconn) {
         return (AUTH_ERROR, undef, "connect_failed");
     }
index 6e70687966a48447f5476fe3a68b77af204cb891..af1a756a4fa9fa5385e71cc34ae0a93dce9017c5 100644 (file)
@@ -26,7 +26,8 @@
 
 [% param_descs = {
   LDAPserver => "The name (and optionally port) of your LDAP server " _
-                "(e.g. ldap.company.com, or ldap.company.com:portnum).",
+                "(e.g. ldap.company.com, or ldap.company.com:portnum). " _
+                "Can be prefixed with ldap:// (default) or ldaps:// (for a secure connection).",
 
   LDAPbinddn => "If your LDAP server requires that you use a binddn and password " _
                 "instead of binding anonymously, enter it here " _