From a705f763f283d4687d9ae7587b7f4f4e8516e878 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 16 Nov 2006 01:28:05 +0000
Subject: [PATCH] Update the LDAP client code to make it possible to specify certain controls by a more user-friendly name instead of the numeric OID when using the "-J" or "--control" option. These changes include:
---
opends/src/server/org/opends/server/tools/LDAPToolUtils.java | 49 +++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPToolUtils.java b/opends/src/server/org/opends/server/tools/LDAPToolUtils.java
index 5dfcabf..d17fc47 100644
--- a/opends/src/server/org/opends/server/tools/LDAPToolUtils.java
+++ b/opends/src/server/org/opends/server/tools/LDAPToolUtils.java
@@ -35,6 +35,8 @@
import org.opends.server.protocols.ldap.LDAPControl;
import static org.opends.server.loggers.Debug.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
@@ -71,13 +73,52 @@
ASN1OctetString controlValue = null;
int idx = argString.indexOf(":");
- if(idx == -1)
+
+ if(idx < 0)
{
- control = new LDAPControl(argString);
- return control;
+ controlOID = argString;
+ }
+ else
+ {
+ controlOID = argString.substring(0, idx);
}
- controlOID = argString.substring(0, idx);
+ String lowerOID = toLowerCase(controlOID);
+ if (lowerOID.equals("accountusable") || lowerOID.equals("accountusability"))
+ {
+ controlOID = OID_ACCOUNT_USABLE_CONTROL;
+ }
+ else if (lowerOID.equals("authzid") ||
+ lowerOID.equals("authorizationidentity"))
+ {
+ controlOID = OID_AUTHZID_REQUEST;
+ }
+ else if (lowerOID.equals("noop") || lowerOID.equals("no-op"))
+ {
+ controlOID = OID_LDAP_NOOP_OPENLDAP_ASSIGNED;
+ }
+ else if (lowerOID.equals("subentries"))
+ {
+ controlOID = OID_LDAP_SUBENTRIES;
+ }
+ else if (lowerOID.equals("managedsait"))
+ {
+ controlOID = OID_MANAGE_DSAIT_CONTROL;
+ }
+ else if (lowerOID.equals("pwpolicy") || lowerOID.equals("passwordpolicy"))
+ {
+ controlOID = OID_PASSWORD_POLICY_CONTROL;
+ }
+ else if (lowerOID.equals("subtreedelete") || lowerOID.equals("treedelete"))
+ {
+ controlOID = OID_SUBTREE_DELETE_CONTROL;
+ }
+
+ if (idx < 0)
+ {
+ return new LDAPControl(controlOID);
+ }
+
String remainder = argString.substring(idx+1, argString.length());
idx = remainder.indexOf(":");
--
Gitblit v1.10.0