From 743d1252ed471c735b89df2307af23ba48b873cd Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sun, 08 Oct 2006 22:34:46 +0000
Subject: [PATCH] Update the LDAPPasswordModify tool to expose the "--useStartTLS" option so that the StartTLS capability can actually be used.  Also, change the order of evaluation for an argument validation check to make testing easier.

---
 opendj-sdk/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
index 9503f01..bff98ee 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -270,6 +270,7 @@
 
       useStartTLS = new BooleanArgument("usestarttls", 'q', "useStartTLS",
                              MSGID_LDAPPWMOD_DESCRIPTION_USE_STARTTLS);
+      argParser.addArgument(useStartTLS);
 
 
       sslBlindTrust =
@@ -410,15 +411,6 @@
     }
     else
     {
-      if (! (authzID.isPresent() && currentPW.isPresent()))
-      {
-        int    msgID   = MSGID_LDAPPWMOD_ANON_REQUIRES_AUTHZID_AND_CURRENTPW;
-        String message = getMessage(msgID);
-        err.println(wrapText(message, MAX_LINE_WIDTH));
-        err.println(argParser.getUsage());
-        return 1;
-      }
-
       if (provideDNForAuthzID.isPresent())
       {
         int    msgID   = MSGID_LDAPPWMOD_DEPENDENT_ARGS;
@@ -429,6 +421,16 @@
         err.println(argParser.getUsage());
         return 1;
       }
+
+      if (! (authzID.isPresent() &&
+             (currentPW.isPresent() || currentPWFile.isPresent())))
+      {
+        int    msgID   = MSGID_LDAPPWMOD_ANON_REQUIRES_AUTHZID_AND_CURRENTPW;
+        String message = getMessage(msgID);
+        err.println(wrapText(message, MAX_LINE_WIDTH));
+        err.println(argParser.getUsage());
+        return 1;
+      }
     }
 
 

--
Gitblit v1.10.0