]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 339731: [LDAP] URI-parsing code duplicated with Net::LDAP - Patch by guillomovitc...
authorlpsolit%gmail.com <>
Tue, 11 Jul 2006 07:42:57 +0000 (07:42 +0000)
committerlpsolit%gmail.com <>
Tue, 11 Jul 2006 07:42:57 +0000 (07:42 +0000)
Bugzilla/Auth/Verify/LDAP.pm
docs/xml/installation.xml
template/en/default/admin/params/ldap.html.tmpl

index 9f050d854924b0f526c66742b80bcec6e8e8c6ad..343f7952cd4dbbd4552af106fdcb9ecd70444c18 100644 (file)
@@ -40,9 +40,6 @@ use Bugzilla::Error;
 
 use Net::LDAP;
 
-use constant DEFAULT_PORT     => 389;
-use constant DEFAULT_SSL_PORT => 636;
-
 use constant admin_can_create_account => 0;
 use constant user_can_create_account  => 0;
 
@@ -140,31 +137,8 @@ sub ldap {
     my $server = Bugzilla->params->{"LDAPserver"};
     ThrowCodeError("ldap_server_not_defined") unless $server;
 
-    my $port = DEFAULT_PORT;
-    my $protocol = "ldap";
-
-    if ($server =~ /(ldap|ldaps):\/\/(.*)/) {
-        # ldap(s)://server(:port)
-        $protocol = $1;
-        my $server_part = $2;
-        if ($server_part =~ /:/) {
-            # ldap(s)://server:port
-            ($server, $port) = split(":", $server_part);
-        } else {
-            # ldap(s)://server
-            $server = $server_part;
-            if ($protocol eq "ldaps") {
-                $port = DEFAULT_SSL_PORT;
-            }
-        }
-    } elsif ($server =~ /:/) {
-        # server:port
-        ($server, $port) = split(":", $server);
-    }
-
-    my $conn_string = "$protocol://$server:$port";
-    $self->{ldap} = new Net::LDAP($conn_string) 
-        || ThrowCodeError("ldap_connect_failed", { server => $conn_string });
+    $self->{ldap} = new Net::LDAP($server)
+        || ThrowCodeError("ldap_connect_failed", { server => $server });
 
     # try to start TLS if needed
     if (Bugzilla->params->{"LDAPstarttls"}) {
index 743d677359df55e0c40c1ec2d45bd55fdfc70780..ce760842e2d02cb6ede7caa35d73e1f9576d938a 100644 (file)
@@ -1,5 +1,5 @@
 <!-- <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"> -->
-<!-- $Id: installation.xml,v 1.121 2006/06/07 23:20:27 vladd%bugzilla.org Exp $ -->
+<!-- $Id: installation.xml,v 1.122 2006/07/11 00:42:58 lpsolit%gmail.com Exp $ -->
 <chapter id="installing-bugzilla">
   <title>Installing Bugzilla</title>
 
@@ -1379,6 +1379,15 @@ c:\perl\bin\perl.exe -xc:\bugzilla -wT "%s" %s
             <para>Ex. <quote>ldap.company.com</quote>
              or <quote>ldap.company.com:3268</quote>
             </para>
+            <para>You can also specify a LDAP URI, so as to use other
+            protocols, such as LDAPS or LDAPI. If port was not specified in
+            the URI, the default is either 389 or 636 for 'LDAP' and 'LDAPS'
+            schemes respectively.
+            </para>
+            <para>Ex. <quote>ldap://ldap.company.com</quote>,
+            <quote>ldaps://ldap.company.com</quote> or
+            <quote>ldapi://%2fvar%2flib%2fldap_sock</quote>
+            </para>
            </listitem>
          </varlistentry>
 
index aef2713b108016a2d5ee0612ce496f7c642d5d71..a3c7e464357f47e88d87a932b323b995470b781d 100644 (file)
 [% param_descs = {
   LDAPserver => "The name (and optionally port) of your LDAP server " _
                 "(e.g. ldap.company.com, or ldap.company.com:portnum). " _
-                "Can be prefixed with ldap:// (default) or ldaps:// (for a secure connection).",
+                "URI syntax can also be used, such as "_
+                "ldaps://ldap.company.com (for a secure connection) or " _
+                "ldapi://%2fvar%2flib%2fldap_sock (for a socket-based " _
+                "local connection.",
 
   LDAPstartls => "Whether to require encrypted communication once normal " _
                  "LDAP connection achieved with the server.",