From c933bedb75818290b5a49ca178fcfc5340dbb3c3 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 15 Nov 2006 19:50:12 +0000
Subject: [PATCH] Update the LDAPSearch, LDAPModify, LDAPCompare, and LDAPDelete tools to rename the "--controls" argument to "--control", since each instance only allows the user to specify information about a single control.  Issue #1009.

---
 opends/src/server/org/opends/server/tools/LDAPModify.java |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/LDAPModify.java b/opends/src/server/org/opends/server/tools/LDAPModify.java
index eea5826..65cc23a 100644
--- a/opends/src/server/org/opends/server/tools/LDAPModify.java
+++ b/opends/src/server/org/opends/server/tools/LDAPModify.java
@@ -726,7 +726,7 @@
       argParser.addArgument(postReadAttributes);
 
       controlStr =
-           new StringArgument("controls", 'J', "controls", false, false, true,
+           new StringArgument("control", 'J', "control", false, true, true,
                     "{controloid[:criticality[:value|::b64value|:<fileurl]]}",
                     null, null, MSGID_DESCRIPTION_CONTROLS);
       argParser.addArgument(controlStr);
@@ -878,19 +878,22 @@
     modifyOptions.setContinueOnError(continueOnError.isPresent());
     modifyOptions.setEncoding(encodingStr.getValue());
     modifyOptions.setDefaultAdd(defaultAdd.isPresent());
-    if(controlStr.hasValue())
+
+    if (controlStr.isPresent())
     {
-      String ctrlString = controlStr.getValue();
-      LDAPControl ctrl = LDAPToolUtils.getControl(ctrlString, err);
-      if(ctrl == null)
+      for (String ctrlString : controlStr.getValues())
       {
-        int    msgID   = MSGID_TOOL_INVALID_CONTROL_STRING;
-        String message = getMessage(msgID, ctrlString);
-        err.println(wrapText(message, MAX_LINE_WIDTH));
-        err.println(argParser.getUsage());
-        return 1;
+        LDAPControl ctrl = LDAPToolUtils.getControl(ctrlString, err);
+        if(ctrl == null)
+        {
+          int    msgID   = MSGID_TOOL_INVALID_CONTROL_STRING;
+          String message = getMessage(msgID, ctrlString);
+          err.println(wrapText(message, MAX_LINE_WIDTH));
+          err.println(argParser.getUsage());
+          return 1;
+        }
+        modifyOptions.getControls().add(ctrl);
       }
-      modifyOptions.getControls().add(ctrl);
     }
 
     if (proxyAuthzID.isPresent())

--
Gitblit v1.10.0