/* See if a policy node matches a policy OID. If mapping enabled look through expected policy set otherwise just valid policy.  */
int policy_node_match(const X509_POLICY_LEVEL *lvl, const X509_POLICY_NODE *node, const ASN1_OBJECT *oid)
/* See if a policy node matches a policy OID. If mapping enabled look through expected policy set otherwise just valid policy.  */
int policy_node_match(const X509_POLICY_LEVEL *lvl, const X509_POLICY_NODE *node, const ASN1_OBJECT *oid)
{
    size_t i;
    ASN1_OBJECT *policy_oid;
    const X509_POLICY_DATA *x = node->data;
    if ((lvl->flags & X509_V_FLAG_INHIBIT_MAP)
        || !(x->flags & POLICY_DATA_FLAG_MAP_MASK)) {
        if (!OBJ_cmp(x->valid_policy, oid))
            return 1;
        return 0;
    }
    for (i = 0; i < sk_ASN1_OBJECT_num(x->expected_policy_set); i++) {
        policy_oid = sk_ASN1_OBJECT_value(x->expected_policy_set, i);
        if (!OBJ_cmp(policy_oid, oid))
            return 1;
    }
    return 0;
}