From d996a30565b65007e7d034da042e55a39bd70d59 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Thu, 12 Jul 2007 23:10:53 +0000
Subject: [PATCH] Fix compiler/analyze warnings and a error message bug.
---
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciTargets.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java | 1
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java | 10 +++--
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java | 4 +-
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java | 38 +++++++++---------
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/BindRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciBody.java | 9 ++++
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java | 2 +
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java | 9 ++--
9 files changed, 45 insertions(+), 32 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
index 46ef3db..272350e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
@@ -62,7 +62,7 @@
/*
* The DN of the entry containing this ACI.
*/
- private DN dn;
+ private final DN dn;
/**
* Regular expression matching a word group.
@@ -89,7 +89,7 @@
/**
* Regular expression matching a white space at the end of a pattern.
*/
- public static final String ZERO_OR_MORE_WHITESPACE_END_PATTERN =
+ private static final String ZERO_OR_MORE_WHITESPACE_END_PATTERN =
ZERO_OR_MORE_WHITESPACE + "$";
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciBody.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciBody.java
index f14e5ad..6022132 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciBody.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciBody.java
@@ -353,4 +353,13 @@
return ACI_EXPORT;
return ACI_NULL;
}
+
+ /**
+ * Return version string of the ACI.
+ *
+ * @return The ACI version string.
+ */
+ public String getVersion () {
+ return version;
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
index cead7a2..d1907c5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -84,18 +84,18 @@
/**
* Attribute type corresponding to "aci" attribute.
*/
- public static AttributeType aciType;
+ static AttributeType aciType;
/**
* Attribute type corresponding to global "ds-cfg-global-aci" attribute.
*/
- public static AttributeType globalAciType;
+ static AttributeType globalAciType;
/**
* String used to save the original authorization entry in an operation
* attachment if a proxied authorization control was seen.
*/
- public static String ORIG_AUTH_ENTRY="origAuthorizationEntry";
+ public static final String ORIG_AUTH_ENTRY="origAuthorizationEntry";
/**
* String used to save a resource entry containing all the attributes in
@@ -103,21 +103,33 @@
* geteffectiverights read right processing when all of an entry'ss
* attributes need to examined.
*/
- public static String ALL_ATTRS_RESOURCE_ENTRY = "allAttrsResourceEntry";
+ public static final String ALL_ATTRS_RESOURCE_ENTRY = "allAttrsResourceEntry";
/**
* String used to indicate that the evaluating ACI had a all user attributes
* targetattr match (targetattr="*").
*/
- public static String ALL_USER_ATTRS_MATCHED = "allUserAttrsMatched";
+ public static final String ALL_USER_ATTRS_MATCHED = "allUserAttrsMatched";
/**
* String used to indicate that the evaluating ACI had a all operational
* attributes targetattr match (targetattr="+").
*/
- public static String ALL_OP_ATTRS_MATCHED = "allOpAttrsMatched";
+ public static final String ALL_OP_ATTRS_MATCHED = "allOpAttrsMatched";
+ static {
+ if((aciType = DirectoryServer.getAttributeType("aci")) == null)
+ {
+ aciType = DirectoryServer.getDefaultAttributeType("aci");
+ }
+ if((globalAciType =
+ DirectoryServer.getAttributeType(ATTR_AUTHZ_GLOBAL_ACI)) == null)
+ {
+ globalAciType =
+ DirectoryServer.getDefaultAttributeType(ATTR_AUTHZ_GLOBAL_ACI);
+ }
+ }
/**
* Creates a new DSEE-compatible access control handler.
@@ -141,18 +153,6 @@
DN configurationDN=configuration.dn();
aciList = new AciList(configurationDN);
aciListenerMgr = new AciListenerManager(aciList, configurationDN);
- if((aciType = DirectoryServer.getAttributeType("aci")) == null)
- {
- aciType = DirectoryServer.getDefaultAttributeType("aci");
- }
-
- if((globalAciType =
- DirectoryServer.getAttributeType(ATTR_AUTHZ_GLOBAL_ACI)) == null)
- {
- globalAciType =
- DirectoryServer.getDefaultAttributeType(ATTR_AUTHZ_GLOBAL_ACI);
- }
-
processGlobalAcis(configuration);
processConfigAcis();
}
@@ -519,7 +519,7 @@
* @return True if access checking can be skipped because
* the operation client connection has BYPASS_ACL privileges.
*/
- boolean skipAccessCheck(Operation operation) {
+ private boolean skipAccessCheck(Operation operation) {
return operation.getClientConnection().
hasPrivilege(Privilege.BYPASS_ACL, operation);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
index bc1972c..563c3e4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
@@ -233,7 +233,6 @@
if(dn == DN.nullDN()) {
msgDN=configDN;
}
- String t=value.getValue().toString();
String message = getMessage(msgID, value.getValue().toString(),
String.valueOf(msgDN),
ex.getMessage());
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciTargets.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciTargets.java
index 41e58a0..ca0a049 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciTargets.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciTargets.java
@@ -157,7 +157,7 @@
* the ACI and check if the resource entry is a descendant of that.
* @return The ACI target class.
*/
- public Target getTarget() {
+ private Target getTarget() {
return target;
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
index 2fed749..6909aa6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
@@ -58,6 +58,8 @@
* Create a class representing an authmethod bind rule keyword from the
* provided method and bind rule type.
* @param type An enumeration representing the type of the expression.
+ * @param saslMech The string representation of the SASL Mechanism.
+ * @param method An Enumeration of the authentication method.
*/
private AuthMethod(EnumAuthMethod method, String saslMech,
EnumBindRuleType type) {
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/BindRule.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/BindRule.java
index 5910b65..27b9e4c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/BindRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/BindRule.java
@@ -486,7 +486,7 @@
EnumBindRuleKeyword keyword,
EnumBindRuleType op)
throws AciException {
- KeywordBindRule rule=null;
+ KeywordBindRule rule ;
switch (keyword) {
case USERDN:
{
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
index 3b8a76e..c084ce1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -55,13 +55,13 @@
/*
* Pattern to match for parent inheritance.
*/
- private String parentPat="parent[";
+ private final String parentPat="parent[";
/*
* Array used to hold the level information. Each slot corresponds to a
* level parsed from the rule.
*/
- private int[] levels=new int[MAX_LEVELS];
+ private final int[] levels=new int[MAX_LEVELS];
/*
* The number of levels parsed.
@@ -200,7 +200,7 @@
if(attrs.size() != 1) {
int msgID = MSGID_ACI_SYNTAX_INVALID_USERATTR_ATTR_URL;
String message = getMessage(msgID, pattern);
- throw new AciException(msgID, pattern);
+ throw new AciException(msgID, message);
}
baseDN=url.getBaseDN();
if(baseDN.isNullDN()){
@@ -237,7 +237,9 @@
* @return Return an array of levels.
*/
public int[] getLevels() {
- return levels;
+ int[] levelsCopy = new int[levels.length];
+ System.arraycopy(levels, 0, levelsCopy, 0, levels.length);
+ return levelsCopy;
}
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java
index 3d0441b..e481b31 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java
@@ -326,7 +326,6 @@
return true;
LinkedHashMap<AttributeType, SearchFilter> filterList =
attrFilterList.getAttributeTypeFilterList();
- Iterator<AttributeType> iterator=filterList.keySet().iterator();
boolean attrMatched=true;
//Get the resource entry.
Entry resEntry=matchCtx.getResourceEntry();
@@ -334,9 +333,9 @@
//the resource entry to see if it has that attribute type. If not
//go to the next attribute type. If it is found, then check the entries
//attribute type values against the filter.
- for(;iterator.hasNext() && attrMatched;) {
- AttributeType attrType=iterator.next();
- SearchFilter f=filterList.get(attrType);
+ for(Map.Entry<AttributeType, SearchFilter> e : filterList.entrySet()) {
+ AttributeType attrType=e.getKey();
+ SearchFilter f=e.getValue();
//Found a match in the entry, iterate over each attribute
//type in the entry and check its values agaist the filter.
if(resEntry.hasAttribute(attrType)) {
@@ -347,6 +346,8 @@
attrMatched=matchFilterAttributeValues(a, attrType, f);
}
}
+ if(!attrMatched)
+ break;
}
if(op.equals(EnumTargetOperator.NOT_EQUALITY))
attrMatched = !attrMatched;
--
Gitblit v1.10.0