DNS.java revision e3fed6978fb8085b119df2966b5c27785756d70b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2013-2014 ForgeRock AS
*/
/**
* This class implements the dns bind rule keyword.
*/
public class DNS implements KeywordBindRule {
/** List of patterns to match against. */
/** The enumeration representing the bind rule type of the DNS rule. */
/** Regular expression group used to match a dns rule. */
/** Regular expression group used to match one or more DNS values. */
private static final String valuesRegExGroup =
/**
* Create a class representing a dns bind rule keyword.
* @param patterns List of dns patterns to match against.
* @param type An enumeration representing the bind rule type.
*/
}
/**
* Decode an string representing a dns bind rule.
* @param expr A string representation of the bind rule.
* @param type An enumeration representing the bind rule type.
* @return A keyword bind rule class that can be used to evaluate
* this bind rule.
* @throws AciException If the expression string is invalid.
*/
throws AciException
{
throw new AciException(message);
}
int valuePos = 1;
while (valueMatcher.find()) {
throw new AciException(message);
}
}
// If the provided hostname does not contain any wildcard
// characters, then it must be the canonical hostname for the
// associated IP address. If it is not, then it will not match the
// intended target, and we should generate a warning message to let
// the administrator know about it. If the provided value does not
// match the canonical name for the associated IP address, and the
// given hostname is "localhost", then we should treat it specially
// and also match the canonical hostname. This is necessary because
// "localhost" is likely to be very commonly used in these kinds of
// rules and on some systems the canonical representation is
// configured to be "localhost.localdomain" which may not be known
// to the administrator.
{
try
{
{
{
{
}
else
{
}
}
}
}
catch (Exception e)
{
logger.traceException(e);
}
}
}
}
/**
* Performs evaluation of dns keyword bind rule using the provided
* evaluation context.
* @param evalCtx An evaluation context to use in the evaluation.
* @return An enumeration evaluation result.
*/
break;
}
}
}
/**
* Checks an array containing the remote client's hostname against
* patterns specified in the bind rule expression. Wild-cards are
* only permitted in the leftmost field and the rest of the domain
* name array components must match. A single wild-card matches any
* hostname.
* @param remoteHostName Array containing components of the remote clients
* hostname (split on ".").
* @param pat An array containing the pattern specified in
* the bind rule expression. The first array slot may be a wild-card "*".
* @return True if the remote hostname matches the pattern.
*/
//Check if there is a single wild-card.
return true;
if(remoteHnIndex < 0)
return false;
int patternIndex=0;
if(!wildCard)
else {
patternIndex=1;
}
return false;
return true;
}
/** {@inheritDoc} */
}
/** {@inheritDoc} */
}
}