From 7886f35b46cac515f73de8c6af33b8d8df3e2a3b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 08 Jun 2007 12:00:22 +0000
Subject: [PATCH] Commit quite a lot of bug fixes to the ADS.

---
 opends/src/ads/org/opends/admin/ads/util/ServerLoader.java |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java b/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
index 76820d1..23b49ce 100644
--- a/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
+++ b/opends/src/ads/org/opends/admin/ads/util/ServerLoader.java
@@ -31,6 +31,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.naming.AuthenticationException;
 import javax.naming.NamingException;
 import javax.naming.NoPermissionException;
 import javax.naming.ldap.InitialLdapContext;
@@ -148,6 +149,31 @@
                 TopologyCacheException.Type.NOT_GLOBAL_ADMINISTRATOR, npe,
                 trustManager, getLastLdapUrl());
       }
+      else
+      {
+        lastException =
+          new TopologyCacheException(
+              TopologyCacheException.Type.NO_PERMISSIONS, npe,
+              trustManager, getLastLdapUrl());
+      }
+    }
+    catch (AuthenticationException ae)
+    {
+      LOG.log(Level.WARNING,
+          "Authentication exception: "+getLastLdapUrl(), ae);
+      if (!isAdministratorDn())
+      {
+        lastException = new TopologyCacheException(
+                TopologyCacheException.Type.NOT_GLOBAL_ADMINISTRATOR, ae,
+                trustManager, getLastLdapUrl());
+      }
+      else
+      {
+        lastException =
+          new TopologyCacheException(
+              TopologyCacheException.Type.GENERIC_READING_SERVER, ae,
+              trustManager, getLastLdapUrl());
+      }
     }
     catch (NamingException ne)
     {
@@ -174,6 +200,7 @@
       {
         LOG.log(Level.WARNING,
             "Generic error reading server: "+getLastLdapUrl(), t);
+        LOG.log(Level.WARNING, "server Properties: "+serverProperties);
         lastException =
             new TopologyCacheException(TopologyCacheException.Type.BUG, t);
       }
@@ -338,7 +365,7 @@
       LdapName theDn = new LdapName(dn);
       LdapName containerDn =
         new LdapName(ADSContext.getAdministratorContainerDN());
-      isAdministratorDn = theDn.endsWith(containerDn);
+      isAdministratorDn = theDn.startsWith(containerDn);
     }
     catch (Throwable t)
     {

--
Gitblit v1.10.0