[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 951 Fixed error handling for Console authentication.



The CMSAdmin class has been modified to show the error dialog
if Console authentication fails.

Pushed to master under trivial rule.

--
Endi S. Dewata
>From 2d89433a5a3706d4cb5a93423d7b9184c74500ba Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata redhat com>
Date: Sat, 18 Feb 2017 09:21:12 +0100
Subject: [PATCH] Fixed error handling for Console authentication.

The CMSAdmin class has been modified to show the error dialog
if Console authentication fails.
---
 .../src/com/netscape/admin/certsrv/CMSAdmin.java   | 70 ++++++++++++-----
 .../src/com/netscape/admin/certsrv/Console.java    | 87 ++++++++++++++++------
 2 files changed, 118 insertions(+), 39 deletions(-)

diff --git a/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java b/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java
index 94bb266d13ad76c3fb5790c81011abe6aaf008d4..778edfac601fa6bed1244ce05426c22d6ba205be 100644
--- a/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java
+++ b/base/console/src/com/netscape/admin/certsrv/CMSAdmin.java
@@ -17,21 +17,55 @@
 // --- END COPYRIGHT BLOCK ---
 package com.netscape.admin.certsrv;
 
-import java.util.*;
-import java.net.*;
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import com.netscape.certsrv.common.*;
-import com.netscape.management.client.*;
-import com.netscape.management.client.topology.*;
-import com.netscape.management.client.console.*;
-import com.netscape.management.client.util.*;
-import com.netscape.admin.certsrv.config.install.*;
-import com.netscape.admin.certsrv.task.*;
-import com.netscape.admin.certsrv.wizard.*;
-import netscape.ldap.*;
+import java.awt.Cursor;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.ResourceBundle;
+
+import javax.swing.Icon;
+import javax.swing.JFrame;
+
+import com.netscape.admin.certsrv.config.install.InstallWizard;
+import com.netscape.admin.certsrv.config.install.InstallWizardInfo;
+import com.netscape.admin.certsrv.task.CMSConfigCert;
+import com.netscape.admin.certsrv.task.CMSRemove;
+import com.netscape.admin.certsrv.task.CMSRestart;
+import com.netscape.admin.certsrv.task.CMSStart;
+import com.netscape.admin.certsrv.task.CMSStartDaemon;
+import com.netscape.admin.certsrv.task.CMSStatus;
+import com.netscape.admin.certsrv.task.CMSStop;
+import com.netscape.admin.certsrv.wizard.IWizardDone;
+import com.netscape.admin.certsrv.wizard.WizardWidget;
+import com.netscape.certsrv.common.ConfigConstants;
+import com.netscape.certsrv.common.OpDef;
+import com.netscape.certsrv.common.TaskId;
+import com.netscape.management.client.Framework;
+import com.netscape.management.client.IMenuInfo;
+import com.netscape.management.client.IMenuItem;
+import com.netscape.management.client.IPage;
+import com.netscape.management.client.IResourceObject;
+import com.netscape.management.client.IStatusItem;
+import com.netscape.management.client.MenuItemSeparator;
+import com.netscape.management.client.MenuItemText;
+import com.netscape.management.client.ResourcePage;
+import com.netscape.management.client.StatusItemSecureMode;
+import com.netscape.management.client.StatusItemText;
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.topology.AbstractServerObject;
+import com.netscape.management.client.topology.IRemovableServerObject;
+import com.netscape.management.client.util.Debug;
+import com.netscape.management.client.util.LDAPUtil;
+import com.netscape.management.client.util.RemoteImage;
+import com.netscape.management.client.util.UtilConsoleGlobals;
+
+import netscape.ldap.LDAPAttribute;
+import netscape.ldap.LDAPConnection;
+import netscape.ldap.LDAPDN;
+import netscape.ldap.LDAPEntry;
+import netscape.ldap.LDAPException;
+import netscape.ldap.LDAPModification;
+import netscape.ldap.LDAPModificationSet;
+import netscape.ldap.LDAPSearchResults;
 
 /**
  * Netscape Certificate Server 4.0 configuration entry point. The
@@ -482,6 +516,8 @@ public class CMSAdmin extends AbstractServerObject
                         mPort = portnum;
                 }
             } catch (Exception e) {
+                CMSAdminUtil.showErrorDialog(mConsoleInfo.getFrame(), mResource,
+                        e.toString(), CMSAdminUtil.ERROR_MESSAGE);
                 return false;
             }
           } catch (LDAPException ex) {
@@ -524,9 +560,9 @@ public class CMSAdmin extends AbstractServerObject
             }
             mConsoleInfo.put("serverInfo", mServerInfo);
         } catch (EAdminException ex) {
-                System.exit(0); // exit if authentication fails
                 CMSAdminUtil.showErrorDialog(mConsoleInfo.getFrame(), mResource,
                     ex.getMessage(), CMSAdminUtil.ERROR_MESSAGE);
+                System.exit(0); // exit if authentication fails
                 return false;
         }
 
@@ -838,7 +874,7 @@ public class CMSAdmin extends AbstractServerObject
       // this entry.
 
       entry = (LDAPEntry)search_results.nextElement();
-      String eDN = (String) entry.getDN();
+      String eDN = entry.getDN();
       // Now we need to modify the entry to delete the
       // reference to the serevr.
       remove_intstanceFromEntry(ldc, eDN, sieDN);
diff --git a/base/console/src/com/netscape/admin/certsrv/Console.java b/base/console/src/com/netscape/admin/certsrv/Console.java
index ca0bfcb2ecfad77e5b8c9eda146fc477a81da4da..d6d653f168376e666542eb6e34891e7e91b5d2be 100644
--- a/base/console/src/com/netscape/admin/certsrv/Console.java
+++ b/base/console/src/com/netscape/admin/certsrv/Console.java
@@ -17,30 +17,73 @@
 // --- END COPYRIGHT BLOCK ---
 package com.netscape.admin.certsrv;
 
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.io.*;
-import java.text.MessageFormat;
-import java.net.URL;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintStream;
 import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.Vector;
 
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
 
-import com.netscape.management.client.console.*;
-import com.netscape.management.nmclf.*;
-import com.netscape.management.client.*;
-import com.netscape.management.client.preferences.*;
-import com.netscape.management.client.components.*;
-import com.netscape.management.client.topology.*;
-import com.netscape.management.client.util.*;
-import com.netscape.management.client.cmd.*;
-import com.netscape.management.client.ug.*;
-import com.netscape.management.client.comm.*;
+import com.netscape.management.client.Framework;
+import com.netscape.management.client.IPage;
+import com.netscape.management.client.IResourceObject;
+import com.netscape.management.client.ResourceObject;
+import com.netscape.management.client.cmd.GetOpt;
+import com.netscape.management.client.comm.CommClient;
+import com.netscape.management.client.comm.CommRecord;
+import com.netscape.management.client.comm.HttpChannel;
+import com.netscape.management.client.comm.HttpException;
+import com.netscape.management.client.comm.HttpManager;
+import com.netscape.management.client.components.FontFactory;
+import com.netscape.management.client.console.ConsoleInfo;
+import com.netscape.management.client.console.LoginDialog;
+import com.netscape.management.client.console.VersionInfo;
+import com.netscape.management.client.preferences.FilePreferences;
+import com.netscape.management.client.preferences.PreferenceManager;
+import com.netscape.management.client.preferences.Preferences;
+import com.netscape.management.client.topology.IServerObject;
+import com.netscape.management.client.topology.ITopologyPlugin;
+import com.netscape.management.client.topology.ServerNode;
+import com.netscape.management.client.topology.ServiceLocator;
+import com.netscape.management.client.topology.TopologyInitializer;
+import com.netscape.management.client.ug.ResourceEditor;
+import com.netscape.management.client.util.ClassLoaderUtil;
+import com.netscape.management.client.util.Debug;
+import com.netscape.management.client.util.KingpinLDAPConnection;
+import com.netscape.management.client.util.LDAPUtil;
+import com.netscape.management.client.util.ModalDialogUtil;
+import com.netscape.management.client.util.RemoteImage;
+import com.netscape.management.client.util.ResourceSet;
+import com.netscape.management.client.util.UtilConsoleGlobals;
+import com.netscape.management.nmclf.SuiLookAndFeel;
 
-import netscape.ldap.*;
+import netscape.ldap.LDAPAttribute;
+import netscape.ldap.LDAPAttributeSet;
+import netscape.ldap.LDAPConnection;
+import netscape.ldap.LDAPEntry;
+import netscape.ldap.LDAPException;
+import netscape.ldap.LDAPSearchConstraints;
+import netscape.ldap.LDAPSearchResults;
 import netscape.ldap.util.DN;
 
 /**
@@ -839,7 +882,7 @@ public class Console implements CommClient {
                     while (result.hasMoreElements()) {
                         LDAPEntry ExtensionEntry;
                         try {
-                            ExtensionEntry = (LDAPEntry) result.next();
+                            ExtensionEntry = result.next();
                         } catch (Exception e) {
                             // ldap exception
                             continue;
@@ -980,7 +1023,7 @@ public class Console implements CommClient {
                 while (results.hasMoreElements()) {
                     LDAPEntry entry;
                     try {
-                        entry = (LDAPEntry) results.next();
+                        entry = results.next();
                     } catch (Exception e) {
                         // ldap exception
                         continue;
-- 
2.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]