From 16a4c18b4c101e8e3dc7b8be756de1807970065f Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 19 Jul 2007 16:12:32 +0000
Subject: [PATCH] Update the server to provide more complete support for the password policy control as described in draft-behera-ldap-password-policy.  In particular, improved support has been provided for all operations for the case in which a user must change his/her password before performing any other types of operations.  These changes also provide enhanced support for add and modify operations that are rejected because a password change is not acceptable for some reason.

---
 opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java |   52 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java b/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
index 21b4065..69ea295 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -94,25 +94,49 @@
    *          program.
    */
   public static void main(String[] args) {
-    DSConfig app = new DSConfig(System.in, System.out, System.err,
-        new LDAPManagementContextFactory());
-    // Only initialize the client environment when run as a standalone
-    // application.
-    try {
-      app.initializeClientEnvironment();
-    } catch (InitializationException e) {
-      // TODO: is this ok as an error message?
-      System.err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
-      System.exit(1);
-    }
-
-    // Run the application.
-    int exitCode = app.run(args);
+    int exitCode = main(args, true, System.out, System.err);
     if (exitCode != 0) {
       System.exit(filterExitCode(exitCode));
     }
   }
 
+  /**
+   * Provides the command-line arguments to the main application for
+   * processing and returns the exit code as an integer.
+   *
+   * @param  args              The set of command-line arguments provided to
+   *                           this program.
+   * @param  initializeServer  Indicates whether to perform basic initialization
+   *                           (which should not be done if the tool is running
+   *                           in the same JVM as the server).
+   * @param  outStream         The output stream for standard output.
+   * @param  errStream         The output stream for standard error.
+   *
+   * @return  Zero to indicate that the program completed successfully, or
+   *          non-zero to indicate that an error occurred.
+   */
+  public static int main(String[] args, boolean initializeServer,
+                         OutputStream outStream, OutputStream errStream)
+  {
+    DSConfig app = new DSConfig(System.in, outStream, errStream,
+        new LDAPManagementContextFactory());
+    // Only initialize the client environment when run as a standalone
+    // application.
+    if (initializeServer)
+    {
+      try {
+        app.initializeClientEnvironment();
+      } catch (InitializationException e) {
+        // TODO: is this ok as an error message?
+        System.err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
+        return 1;
+      }
+    }
+
+    // Run the application.
+    return app.run(args);
+  }
+
   // Flag indicating whether or not the application environment has
   // already been initialized.
   private boolean environmentInitialized = false;

--
Gitblit v1.10.0