mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
16.41.2015 040cba63ba4af5bed76846f0edb63c853b009da9
opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
@@ -1552,9 +1552,9 @@
   */
  private static LdapName makeDNFromServerProperties(
      Map<ServerProperty, Object> serverProperties) throws ADSContextException
      {
    String serverID ;
    if ( (serverID = getServerID(serverProperties)) != null )
  {
    String serverID = getServerID(serverProperties) ;
    if (serverID != null)
    {
      return makeDNFromServerUniqueId(serverID);
    }
@@ -1570,7 +1570,7 @@
      ServerDescriptor s = ServerDescriptor.createStandalone(serverProperties);
      return makeDNFromServerUniqueId(s.getHostPort(true));
    }
      }
  }
  /**
   * This method returns the DN of the entry that corresponds to the given
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -243,11 +243,9 @@
    private void doPostAdd(Entry addedEntry)
    {
      // This entry might have both global and aci attribute types.
      boolean hasAci, hasGlobalAci = false;
      if ((hasAci = addedEntry
          .hasOperationalAttribute(AciHandler.aciType))
          || (hasGlobalAci = addedEntry
              .hasAttribute(AciHandler.globalAciType)))
      boolean hasAci = addedEntry.hasOperationalAttribute(AciHandler.aciType);
      boolean hasGlobalAci = addedEntry.hasAttribute(AciHandler.globalAciType);
      if (hasAci || hasGlobalAci)
      {
        // Ignore this list, the ACI syntax has already passed and it
        // should be empty.
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -226,11 +226,12 @@
     * @return The attribute type.
     */
    public AttributeType getAttributeType() {
      AttributeType attrType;
      if((attrType =
           DirectoryServer.getAttributeType(attrTypeStr.toLowerCase())) == null)
        attrType=
             DirectoryServer.getDefaultAttributeType(attrTypeStr.toLowerCase());
      final String attrName = attrTypeStr.toLowerCase();
      AttributeType attrType = DirectoryServer.getAttributeType(attrName);
      if(attrType == null)
      {
        attrType = DirectoryServer.getDefaultAttributeType(attrName);
      }
      return attrType;
    }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternDN.java
@@ -995,8 +995,8 @@
      int namePos = 0;
      int nameLength = attributeName.length();
      char ch = attributeName.charAt(0);
      if ((ch == 'o') || (ch == 'O'))
      char ch0 = attributeName.charAt(0);
      if (ch0 == 'o' || ch0 == 'O')
      {
        if (nameLength <= 4)
        {
@@ -1004,11 +1004,11 @@
        }
        else
        {
          if ((((ch = attributeName.charAt(1)) == 'i') ||
               (ch == 'I')) &&
              (((ch = attributeName.charAt(2)) == 'd') ||
               (ch == 'D')) &&
              (attributeName.charAt(3) == '.'))
          char ch1 = attributeName.charAt(1);
          char ch2 = attributeName.charAt(2);
          if ((ch1 == 'i' || ch1 == 'I')
              && (ch2 == 'd' || ch2 == 'D')
              && attributeName.charAt(3) == '.')
          {
            attributeName.delete(0, 4);
            nameLength -= 4;
@@ -1022,7 +1022,7 @@
      while (validOID && (namePos < nameLength))
      {
        ch = attributeName.charAt(namePos++);
        char ch = attributeName.charAt(namePos++);
        if (isDigit(ch))
        {
          while (validOID && (namePos < nameLength) &&
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Permission.java
@@ -74,8 +74,8 @@
     */
    private Permission(String accessType, String rights)
    throws AciException {
        if ((this.accessType =
            EnumAccessType.decode(accessType)) == null){
        this.accessType = EnumAccessType.decode(accessType);
        if (this.accessType == null){
            LocalizableMessage message =
                WARN_ACI_SYNTAX_INVALID_ACCESS_TYPE_VERSION.get(accessType);
            throw new AciException(message);
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
@@ -131,16 +131,15 @@
            if (semicolon != -1)
                attributeName=attributeName.substring(0, semicolon);
            String filterString=matcher.group(filterPos);
            AttributeType attributeType;
            if((attributeType =
                    DirectoryServer.getAttributeType(attributeName)) == null)
                attributeType =
                        DirectoryServer.getDefaultAttributeType(attributeName);
            AttributeType attrType = DirectoryServer.getAttributeType(attributeName);
            if (attrType == null) {
                attrType = DirectoryServer.getDefaultAttributeType(attributeName);
            }
            SearchFilter filter;
            //Check if it is a valid filter and add it to the list map if ok.
            try {
               filter = SearchFilter.createFilterFromString(filterString);
               attrFilterList.put(attributeType, filter);
               attrFilterList.put(attrType, filter);
            } catch (DirectoryException ex) {
                LocalizableMessage er=ex.getMessageObject();
                LocalizableMessage message =
@@ -149,9 +148,8 @@
                throw new AciException(message);
            }
            //Verify the filter components. This check assures that each
            //attribute type in the filter matches the provided attribute
            //type.
            verifyFilterComponents(filter, attributeType);
            //attribute type in the filter matches the provided attribute type.
            verifyFilterComponents(filter, attrType);
        }
        return new TargAttrFilterList(mask, attrFilterList);
    }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -150,15 +150,14 @@
                    throw new AciException(message);
                }
            } else {
                AttributeType attributeType;
                if((attributeType =
                        DirectoryServer.getAttributeType(attribute)) == null)
                    attributeType =
                            DirectoryServer.getDefaultAttributeType(attribute);
                if(attributeType.isOperational())
                    opAttributes.add(attributeType);
                AttributeType attrType = DirectoryServer.getAttributeType(attribute);
                if (attrType == null) {
                    attrType = DirectoryServer.getDefaultAttributeType(attribute);
                }
                if(attrType.isOperational())
                    opAttributes.add(attrType);
                else
                    attributes.add(attributeType);
                    attributes.add(attrType);
            }
        }
    }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
@@ -201,8 +201,8 @@
    private EnumEvalResult evalVAL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        boolean undefined=false;
        AttributeType attrType;
        if((attrType = DirectoryServer.getAttributeType(attrStr)) == null) {
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        if (attrType == null) {
            attrType = DirectoryServer.getDefaultAttributeType(attrStr);
        }
        final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT);
@@ -232,8 +232,8 @@
    private EnumEvalResult evalURL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        boolean undefined=false;
        AttributeType attrType;
        if((attrType = DirectoryServer.getAttributeType(attrStr)) == null) {
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        if (attrType == null) {
            attrType = DirectoryServer.getDefaultAttributeType(attrStr);
        }
        List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType);
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -577,12 +577,12 @@
    AttributeList attrList = new AttributeList(attributes.length);
    Attribute attr;
    for (String name : attributes)
    {
      try
      {
        if ((attr = getJmxAttribute(name)) != null)
        Attribute attr = getJmxAttribute(name);
        if (attr != null)
        {
          attrList.add(attr);
          continue;
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
@@ -112,18 +112,17 @@
          }
          //There is an sequence containing an attribute list, try to decode it.
          if(reader.hasNextElement()) {
            AttributeType attributeType;
            attrs = new LinkedList<AttributeType>();
            reader.readStartSequence();
            while(reader.hasNextElement()) {
              //Decode as an octet string.
              String attrStr = reader.readOctetStringAsString();
              AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
              //Get an attribute type for it and add to the list.
              if((attributeType =
                  DirectoryServer.getAttributeType(attrStr)) == null)
                attributeType =
                    DirectoryServer.getDefaultAttributeType(attrStr);
              attrs.add(attributeType);
              if (attrType == null) {
                attrType = DirectoryServer.getDefaultAttributeType(attrStr);
              }
              attrs.add(attrType);
            }
            reader.readEndSequence();
          }
opendj-server-legacy/src/main/java/org/opends/server/extensions/SASLContext.java
@@ -724,7 +724,8 @@
      {
        try
        {
          if ((authzEntry = DirectoryServer.getEntry(authzDN)) == null)
          authzEntry = DirectoryServer.getEntry(authzDN);
          if (authzEntry == null)
          {
            setCallbackMsg(ERR_SASL_AUTHZID_NO_SUCH_ENTRY.get(authzDN));
            callback.setAuthorized(false);
opendj-server-legacy/src/main/java/org/opends/server/schema/AttributeTypeSyntax.java
@@ -711,8 +711,8 @@
            if (c == '}')
            {
              // The next character must be a space or a closing parenthesis.
              if ((c = lowerStr.charAt(pos)) != ' '
                      &&  (c = lowerStr.charAt(pos)) != ')')
              c = lowerStr.charAt(pos);
              if (c != ' ' && c != ')')
              {
                LocalizableMessage message =
                  ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_CHAR_IN_NUMERIC_OID.get(valueStr, c, pos - 1);
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -1525,8 +1525,8 @@
      int namePos = 0;
      int nameLength = nameBytes.length();
      byte ch = nameBytes.byteAt(0);
      if ((ch == 'o') || (ch == 'O'))
      byte ch0 = nameBytes.byteAt(0);
      if (ch0 == 'o' || ch0 == 'O')
      {
        if (nameLength <= 4)
        {
@@ -1534,11 +1534,11 @@
        }
        else
        {
          if ((((ch = nameBytes.byteAt(1)) == 'i') ||
               (ch == 'I')) &&
              (((ch = nameBytes.byteAt(2)) == 'd') ||
               (ch == 'D')) &&
              (nameBytes.byteAt(3) == '.'))
          byte ch1 = nameBytes.byteAt(1);
          byte ch2 = nameBytes.byteAt(1);
          if ((ch1 == 'i' || ch1 == 'I')
              && (ch2 == 'd' || ch2 == 'D')
              && nameBytes.byteAt(3) == '.')
          {
            nameBytes = nameBytes.subSequence(4, nameBytes.length());
            nameLength -= 4;
@@ -1552,7 +1552,7 @@
      while (validOID && (namePos < nameLength))
      {
        ch = nameBytes.byteAt(namePos++);
        byte ch = nameBytes.byteAt(namePos++);
        if (isDigit((char)ch))
        {
          while (validOID && (namePos < nameLength) &&
@@ -1930,8 +1930,8 @@
      int namePos = 0;
      int nameLength = attributeName.length();
      char ch = attributeName.charAt(0);
      if ((ch == 'o') || (ch == 'O'))
      char ch0 = attributeName.charAt(0);
      if (ch0 == 'o' || ch0 == 'O')
      {
        if (nameLength <= 4)
        {
@@ -1939,11 +1939,11 @@
        }
        else
        {
          if ((((ch = attributeName.charAt(1)) == 'i') ||
               (ch == 'I')) &&
              (((ch = attributeName.charAt(2)) == 'd') ||
               (ch == 'D')) &&
              (attributeName.charAt(3) == '.'))
          char ch1 = attributeName.charAt(1);
          char ch2 = attributeName.charAt(2);
          if ((ch1 == 'i' || ch1 == 'I')
              && (ch2 == 'd' || ch2 == 'D')
              && attributeName.charAt(3) == '.')
          {
            attributeName.delete(0, 4);
            nameLength -= 4;
@@ -1957,7 +1957,7 @@
      while (validOID && (namePos < nameLength))
      {
        ch = attributeName.charAt(namePos++);
        char ch = attributeName.charAt(namePos++);
        if (isDigit(ch))
        {
          while (validOID && (namePos < nameLength) &&
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
@@ -411,11 +411,11 @@
  {
    EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator);
    TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString);
    AttributeType attributeType;
    if((attributeType =
          DirectoryServer.getAttributeType(attribute)) == null)
      attributeType = DirectoryServer.getDefaultAttributeType(attribute);
    Boolean res = TargetAttr.isApplicable(attributeType, targetAttr);
    AttributeType attrType = DirectoryServer.getAttributeType(attribute);
    if (attrType == null) {
      attrType = DirectoryServer.getDefaultAttributeType(attribute);
    }
    Boolean res = TargetAttr.isApplicable(attrType, targetAttr);
    Assert.assertEquals(res, expectedResult);
  }
}