jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java
changeset 25808 e113d0a0fde0
parent 23010 6dadb192ad81
equal deleted inserted replaced
25807:6c325960c9ee 25808:e113d0a0fde0
  1649      * the one for the root of the DIT (by looking for the root's
  1649      * the one for the root of the DIT (by looking for the root's
  1650      * "subschemasubentry" attribute).
  1650      * "subschemasubentry" attribute).
  1651      *
  1651      *
  1652      * This function is called regardless of the server's version, since
  1652      * This function is called regardless of the server's version, since
  1653      * an administrator may have setup the server to support client schema
  1653      * an administrator may have setup the server to support client schema
  1654      * queries. If this function trys a serarch on a v2 server that
  1654      * queries. If this function tries a search on a v2 server that
  1655      * doesn't support schema, one of these two things will happen:
  1655      * doesn't support schema, one of these two things will happen:
  1656      * 1) It will get an exception when querying the root DSE
  1656      * 1) It will get an exception when querying the root DSE
  1657      * 2) It will not find a subschemasubentry on the root DSE
  1657      * 2) It will not find a subschemasubentry on the root DSE
  1658      * If either of these things occur and the server is not v3, we
  1658      * If either of these things occur and the server is not v3, we
  1659      * throw OperationNotSupported.
  1659      * throw OperationNotSupported.
  2014      *    - the scope is set to OBJECT_SCOPE
  2014      *    - the scope is set to OBJECT_SCOPE
  2015      *    - the filter string contains a simple assertion: "<type>=<value>"
  2015      *    - the filter string contains a simple assertion: "<type>=<value>"
  2016      *    - the returning attributes list is present but empty
  2016      *    - the returning attributes list is present but empty
  2017      */
  2017      */
  2018 
  2018 
  2019     // returns true if a search can be caried out as a compare, and sets
  2019     // returns true if a search can be carried out as a compare, and sets
  2020     // tokens[0] and tokens[1] to the type and value respectively.
  2020     // tokens[0] and tokens[1] to the type and value respectively.
  2021     // e.g. filter "cn=Jon Ruiz" becomes, type "cn" and value "Jon Ruiz"
  2021     // e.g. filter "cn=Jon Ruiz" becomes, type "cn" and value "Jon Ruiz"
  2022     // This function uses the documents JNDI Compare example as a model
  2022     // This function uses the documents JNDI Compare example as a model
  2023     // for when to turn a search into a compare.
  2023     // for when to turn a search into a compare.
  2024 
  2024 
  2081         } else if ((tokens[0].charAt(0) == '(') ||
  2081         } else if ((tokens[0].charAt(0) == '(') ||
  2082             (tokens[1].charAt(len - 1) == ')')) {
  2082             (tokens[1].charAt(len - 1) == ')')) {
  2083             return false; // unbalanced
  2083             return false; // unbalanced
  2084         }
  2084         }
  2085 
  2085 
  2086         // make sure the left and right half are not expresions themselves
  2086         // make sure the left and right half are not expressions themselves
  2087         StringTokenizer illegalCharsTokenizer =
  2087         StringTokenizer illegalCharsTokenizer =
  2088             new StringTokenizer(tokens[0], "()&|!=~><*", true);
  2088             new StringTokenizer(tokens[0], "()&|!=~><*", true);
  2089 
  2089 
  2090         if (illegalCharsTokenizer.countTokens() != (hasParens ? 2 : 1)) {
  2090         if (illegalCharsTokenizer.countTokens() != (hasParens ? 2 : 1)) {
  2091             return false;
  2091             return false;
  2441 
  2441 
  2442         } // else, leave alone; need not update
  2442         } // else, leave alone; need not update
  2443     }
  2443     }
  2444 
  2444 
  2445     /**
  2445     /**
  2446      * Set whether aliases are derefereced during resolution and searches.
  2446      * Set whether aliases are dereferenced during resolution and searches.
  2447      */
  2447      */
  2448     private void setDerefAliases(String deref) {
  2448     private void setDerefAliases(String deref) {
  2449         if (deref != null) {
  2449         if (deref != null) {
  2450             switch (deref) {
  2450             switch (deref) {
  2451                 case "never":
  2451                 case "never":