Compares the URLs of two resources, and returns the appropriate result.
#include "am_policy.h" AM_EXPORT am_resource_match_t am_policy_compare_urls(const am_resource_traits_t *rsrc_traits, const char *policy_resource_name, const char *resource_name, boolean_t use_patterns);
This function takes the following parameter:
Pointer to a am_resource_traits_t type containing data regarding a policy.
See am_resource_traits_t for more information.
Pointer to the name of the resource being protected.
Pointer to the name of the resource being requested.
Based on the boolean_t defined in the <am_types.h> header file, B_TRUE indicates that the function will consider occurrences of * in policy_resource_name as wild cards. If B_FALSE, occurrences of * are taken as a literal characters.
In cases of SUB_RESOURCE_MATCH and SUPER_RESOURCE_MATCH when usePatterns is B_TRUE, the patterns are sub or super matching patterns, respectively.
This function returns one of the following values of the am_resource_match_t enumeration as defined:
#include "am_policy.h" typedef enum am_resource_match { AM_SUB_RESOURCE_MATCH, AM_EXACT_MATCH, AM_SUPER_RESOURCE_MATCH, AM_NO_MATCH, AM_EXACT_PATTERN_MATCH } am_resource_match_t;
If both URLs match exactly as in, for example, if the URL for the resource is http://example.sun.com:90/index.html and the URL in the policy is http://example.sun.com:90/index.html.
This result is returned if the URL to which the policy applies matches the URL to which access is requested as in, for example, if the URL for the resource is http://example.sun.com:90/index.html and the URL in the policy is http://example.sun.com:90/*. Distinction is not made between an EXACT_MATCH or a pattern match.
If the URLs do not match.
If the requested URL is found to be a sub-resource of the URL defined in the policy.
If the requested URL is found to be a parent of the URL defined in the policy.