| | |
| | | // whitespace. |
| | | int pos = 0; |
| | | int length = valueStr.length(); |
| | | while ((pos < length) && (valueStr.charAt(pos) == ' ')) |
| | | while (pos < length && valueStr.charAt(pos) == ' ') |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | if (c != '(') |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get( |
| | | valueStr, (pos-1), c); |
| | | valueStr, pos-1, c); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | | |
| | | |
| | | // Skip over any spaces immediately following the opening parenthesis. |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | |
| | | // The next set of characters must be the rule ID, which is an integer. |
| | | int ruleIDStartPos = pos; |
| | | while ((pos < length) && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | { |
| | | if (! isDigit(c)) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_RULE_ID.get( |
| | | valueStr, c, (pos-1)); |
| | | valueStr, c, pos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | |
| | | |
| | | |
| | | // Skip over the space(s) after the rule ID. |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | if (pos < length) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_UNEXPECTED_CLOSE_PARENTHESIS. |
| | | get(valueStr, (pos-1)); |
| | | get(valueStr, pos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | |
| | | { |
| | | StringBuilder userBuffer = new StringBuilder(); |
| | | StringBuilder lowerBuffer = new StringBuilder(); |
| | | pos = readQuotedString(valueStr, lowerStr, userBuffer, lowerBuffer, |
| | | (pos-1)); |
| | | pos = readQuotedString(valueStr, lowerStr, userBuffer, lowerBuffer, pos-1); |
| | | names.put(lowerBuffer.toString(), userBuffer.toString()); |
| | | } |
| | | else if (c == '(') |
| | |
| | | { |
| | | // Skip over any spaces after the parenthesis. |
| | | pos++; |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | { |
| | | // This is an illegal character. |
| | | LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR.get(valueStr, c, (pos-1)); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR.get(valueStr, c, pos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | | } |
| | | else if (lowerTokenName.equals("desc")) |
| | |
| | | |
| | | nameFormGiven = true; |
| | | nameForm = schema.getNameForm(woidBuffer.toString()); |
| | | if ((nameForm == null) && (! allowUnknownElements)) |
| | | if (nameForm == null && ! allowUnknownElements) |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | ERR_ATTR_SYNTAX_DSR_UNKNOWN_NAME_FORM.get(valueStr, woidBuffer)); |
| | |
| | | while (true) |
| | | { |
| | | // Skip over any leading spaces. |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | |
| | | // Read the next integer value. |
| | | ruleIDStartPos = pos; |
| | | while ((pos < length) && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | { |
| | | if (! isDigit(c)) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_RULE_ID. |
| | | get(valueStr, c, (pos-1)); |
| | | get(valueStr, c, pos-1); |
| | | throw new DirectoryException( |
| | | ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | |
| | | |
| | | |
| | | // Skip over any trailing spaces. |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | if (c == ')') |
| | | { |
| | | pos++; |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | |
| | | // Read the next integer value. |
| | | ruleIDStartPos = pos - 1; |
| | | while ((pos < length) && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos++)) != ' ')) |
| | | { |
| | | if (! isDigit(c)) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_RULE_ID.get(valueStr, c, (pos-1)); |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_RULE_ID.get(valueStr, c, pos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | |
| | | |
| | | |
| | | // Skip over any trailing spaces. |
| | | while ((pos < length) && ((c = valueStr.charAt(pos)) == ' ')) |
| | | while (pos < length && ((c = valueStr.charAt(pos)) == ' ')) |
| | | { |
| | | pos++; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | if ((nameForm == null) && (! nameFormGiven)) |
| | | if (nameForm == null && !nameFormGiven) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(valueStr); |
| | | throw new DirectoryException( |
| | |
| | | // Skip over any spaces at the beginning of the value. |
| | | char c = '\u0000'; |
| | | int length = valueStr.length(); |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | |
| | | |
| | | // Read until we find the next space. |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos++)) != ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos++)) != ' ')) |
| | | { |
| | | tokenName.append(c); |
| | | } |
| | | |
| | | |
| | | // Skip over any trailing spaces after the value. |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // Skip over any spaces at the beginning of the value. |
| | | char c = '\u0000'; |
| | | int length = valueStr.length(); |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | |
| | | // Read until we find the closing quote. |
| | | startPos++; |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) != '\'')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) != '\'')) |
| | | { |
| | | valueBuffer.append(c); |
| | | startPos++; |
| | |
| | | |
| | | // Skip over any trailing spaces after the value. |
| | | startPos++; |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // Skip over any spaces at the beginning of the value. |
| | | char c = '\u0000'; |
| | | int length = lowerStr.length(); |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | |
| | | // Read until we find the closing quote. |
| | | startPos++; |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos)) != '\'')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos)) != '\'')) |
| | | { |
| | | lowerBuffer.append(c); |
| | | userBuffer.append(valueStr.charAt(startPos)); |
| | |
| | | |
| | | // Skip over any trailing spaces after the value. |
| | | startPos++; |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // Skip over any spaces at the beginning of the value. |
| | | char c = '\u0000'; |
| | | int length = lowerStr.length(); |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // This must be a numeric OID. In that case, we will accept only digits |
| | | // and periods, but not consecutive periods. |
| | | boolean lastWasPeriod = false; |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos++)) != ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos++)) != ' ')) |
| | | { |
| | | if (c == '.') |
| | | { |
| | | if (lastWasPeriod) |
| | | { |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_DOUBLE_PERIOD_IN_NUMERIC_OID. |
| | | get(lowerStr, (startPos-1)); |
| | | get(lowerStr, startPos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | } |
| | |
| | | // additional characters. |
| | | if (c == ')') |
| | | { |
| | | return (startPos-1); |
| | | return startPos-1; |
| | | } |
| | | |
| | | // This must have been an illegal character. |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_NUMERIC_OID.get(lowerStr, c, (startPos-1)); |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_NUMERIC_OID.get(lowerStr, c, startPos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | | else |
| | |
| | | // This must be an attribute type/objectclass description. In this case, |
| | | // we will only accept alphabetic characters, numeric digits, and the |
| | | // hyphen. |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos++)) != ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos++)) != ' ')) |
| | | { |
| | | if (isAlpha(c) || isDigit(c) || (c == '-') || |
| | | ((c == '_') && DirectoryServer.allowAttributeNameExceptions())) |
| | | if (isAlpha(c) || isDigit(c) || c == '-' || |
| | | (c == '_' && DirectoryServer.allowAttributeNameExceptions())) |
| | | { |
| | | woidBuffer.append(c); |
| | | } |
| | |
| | | // additional characters. |
| | | if (c == ')') |
| | | { |
| | | return (startPos-1); |
| | | return startPos-1; |
| | | } |
| | | |
| | | // This must have been an illegal character. |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_STRING_OID.get(lowerStr, c, (startPos-1)); |
| | | LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_ILLEGAL_CHAR_IN_STRING_OID.get(lowerStr, c, startPos-1); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | // Skip over any trailing spaces after the value. |
| | | while ((startPos < length) && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = lowerStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // Skip over any leading spaces. |
| | | int length = valueStr.length(); |
| | | char c = '\u0000'; |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // Parse until the closing quote. |
| | | StringBuilder valueBuffer = new StringBuilder(); |
| | | startPos++; |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) != '\'')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) != '\'')) |
| | | { |
| | | valueBuffer.append(c); |
| | | startPos++; |
| | |
| | | while (true) |
| | | { |
| | | // Skip over any leading spaces; |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) == ' ')) |
| | | { |
| | | startPos++; |
| | | } |
| | |
| | | // We have a quoted string |
| | | StringBuilder valueBuffer = new StringBuilder(); |
| | | startPos++; |
| | | while ((startPos < length) && |
| | | ((c = valueStr.charAt(startPos)) != '\'')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) != '\'')) |
| | | { |
| | | valueBuffer.append(c); |
| | | startPos++; |
| | |
| | | { |
| | | //Consider unquoted string |
| | | StringBuilder valueBuffer = new StringBuilder(); |
| | | while ((startPos < length) && |
| | | ((c = valueStr.charAt(startPos)) != ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) != ' ')) |
| | | { |
| | | valueBuffer.append(c); |
| | | startPos++; |
| | |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DSR_TRUNCATED_VALUE.get(valueStr); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, |
| | | message); |
| | | throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX, message); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | // Parse until the next space. |
| | | StringBuilder valueBuffer = new StringBuilder(); |
| | | while ((startPos < length) && ((c = valueStr.charAt(startPos)) != ' ')) |
| | | while (startPos < length && ((c = valueStr.charAt(startPos)) != ' ')) |
| | | { |
| | | valueBuffer.append(c); |
| | | startPos++; |
| | |
| | | } |
| | | |
| | | // Skip over any trailing spaces. |
| | | while ((startPos < length) && (valueStr.charAt(startPos) == ' ')) |
| | | while (startPos < length && valueStr.charAt(startPos) == ' ') |
| | | { |
| | | startPos++; |
| | | } |