>From 56824d9699ad2f471ac4ec30c24c0600735e42f7 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@redhat.com>
Date: Tue, 20 Jul 2010 14:18:00 -0700
Subject: [PATCH] Fix perl URL parsing code to work with OpenLDAP.

When using PerLDAP built against OpenLDAP, the URL parsing works
a bit differently.  This patch makes the Admin Server perl code
work with PerLDAP that uses either OpenLDAP or MozLDAP under the
covers.
---
 admserv/newinst/src/AdminUtil.pm.in |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/admserv/newinst/src/AdminUtil.pm.in b/admserv/newinst/src/AdminUtil.pm.in
index d3808cc..587d408 100644
--- a/admserv/newinst/src/AdminUtil.pm.in
+++ b/admserv/newinst/src/AdminUtil.pm.in
@@ -168,7 +168,15 @@ sub getConfigDSConn {
     my $host = $h->{host};
     my $port = $h->{port};
     my $basedn = $h->{dn};
-    if ($h->{options} & LDAP_URL_OPT_SECURE) {
+
+    # If PerLDAP was build using OpenLDAP, we must check the URL scheme
+    # to see if we're using LDAPS.  If MozLDAP is being used, we need
+    # to check for the secure option.
+    if ($h->{scheme}) {
+        if ($h->{scheme} eq "ldaps") {
+            $certdir = getCertDir($configdir);
+        }
+    } elsif ($h->{options} & LDAP_URL_OPT_SECURE) {
         $certdir = getCertDir($configdir);
     }
 
-- 
1.6.2.5

