From b4e7c2adbcf17bb3017ffc4aad6d395187bc4e59 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sun, 29 Jul 2007 20:58:29 +0000
Subject: [PATCH] Add support for a new disconnect client task that can be used to allow an administrator to terminate a client connection if the need arises.  The requester must have the disconnect-client privilege.  The task entry should contain the ds-task-disconnect object class, which requires the ds-task-disconnect-connection-id attribute type and optionally allows the ds-task-disconnect-notify-client and ds-task-disconnect-message attribute types.

---
 opends/src/server/org/opends/server/messages/TaskMessages.java |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/messages/TaskMessages.java b/opends/src/server/org/opends/server/messages/TaskMessages.java
index 9828f8c..364ee2d 100644
--- a/opends/src/server/org/opends/server/messages/TaskMessages.java
+++ b/opends/src/server/org/opends/server/messages/TaskMessages.java
@@ -274,6 +274,76 @@
 
 
   /**
+   * The message ID for the message that will be used if the client does not
+   * have the DISCONNECT_CLIENT privilege.  It does not take any arguments.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_NO_PRIVILEGE =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 25;
+
+
+
+  /**
+   * The message ID for the message that will be used if the provided connection
+   * ID cannot be decoded.  This takes a single argument, which is the invalid
+   * value.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_INVALID_CONN_ID =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 26;
+
+
+
+  /**
+   * The message ID for the message that will be used if the task entry does
+   * not specify a target connection ID.  This takes a single argument, which is
+   * the name of the attribute type used to specify the target connection ID.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_NO_CONN_ID =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 27;
+
+
+
+  /**
+   * The message ID for the message that will be used if the notifyClient
+   * attribute value cannot be decoded.  This takes a single argument, which is
+   * the invalid value.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_INVALID_NOTIFY_CLIENT =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 28;
+
+
+
+  /**
+   * The message ID for the message that will be used as a generic message that
+   * may be sent to the client if no other value is given.  It does not take
+   * any arguments.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_GENERIC_MESSAGE =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_INFORMATIONAL | 29;
+
+
+
+  /**
+   * The message ID for the message that will be used if no client connection
+   * can be found with the specified connection ID.  It takes a single argument,
+   * which is the target connection ID.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_NO_SUCH_CONNECTION =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_SEVERE_ERROR | 30;
+
+
+
+  /**
+   * The message ID for the message that will be used as the message ID for the
+   * disconnectClient method.  The associated message will be defined, but it
+   * will not actually be used, since only the message ID is needed.  It does
+   * not take any arguments.
+   */
+  public static final int  MSGID_TASK_DISCONNECT_MESSAGE =
+       CATEGORY_MASK_TASK | SEVERITY_MASK_INFORMATIONAL | 31;
+
+
+
+  /**
    * Associates a set of generic messages with the message IDs defined in this
    * class.
    */
@@ -362,6 +432,26 @@
     registerMessage(MSGID_TASK_LEAVELOCKDOWN_NOT_LOOPBACK,
                     "Only root users connected from a loopback address may " +
                     "cause the server to leave lockdown mode");
+
+
+    registerMessage(MSGID_TASK_DISCONNECT_NO_PRIVILEGE,
+                    "You do not have sufficient privileges to terminate " +
+                    "client connections");
+    registerMessage(MSGID_TASK_DISCONNECT_INVALID_CONN_ID,
+                    "Unable to decode value %s as an integer connection ID");
+    registerMessage(MSGID_TASK_DISCONNECT_NO_CONN_ID,
+                    "Attribute %s must be provided to specify the connection " +
+                    "ID for the client to disconnect");
+    registerMessage(MSGID_TASK_DISCONNECT_INVALID_NOTIFY_CLIENT,
+                    "Unable to decode value %s as an indication of whether " +
+                    "to notify the client before disconnecting it.  The " +
+                    "provided value should be either 'true' or 'false'");
+    registerMessage(MSGID_TASK_DISCONNECT_GENERIC_MESSAGE,
+                    "An administrator has terminated this client connection");
+    registerMessage(MSGID_TASK_DISCONNECT_NO_SUCH_CONNECTION,
+                    "There is no client connection with connection ID %s");
+    registerMessage(MSGID_TASK_DISCONNECT_MESSAGE,
+                    "An administrator has terminated this client connection");
   }
 }
 

--
Gitblit v1.10.0