(hx509_query_match_cmp_func): allow setting the match function.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18909 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-11-04 23:27:49 +00:00
parent 6cf72f998b
commit c226612caa

View File

@@ -1852,6 +1852,20 @@ hx509_query_match_friendly_name(hx509_query *q, const char *name)
return 0; return 0;
} }
int
hx509_query_match_cmp_func(hx509_query *q,
int (*func)(void *, hx509_cert),
void *ctx)
{
if (func)
q->match |= HX509_QUERY_MATCH_FUNCTION;
else
q->match &= ~HX509_QUERY_MATCH_FUNCTION;
q->cmp_func = func;
q->cmp_func_ctx = ctx;
}
void void
hx509_query_free(hx509_context context, hx509_query *q) hx509_query_free(hx509_context context, hx509_query *q)
{ {
@@ -1953,7 +1967,7 @@ _hx509_query_match_cert(hx509_context context, const hx509_query *q, hx509_cert
return 0; return 0;
} }
if (q->match & HX509_QUERY_MATCH_FUNCTION) { if (q->match & HX509_QUERY_MATCH_FUNCTION) {
int ret = (*q->cmp_func)(cert); int ret = (*q->cmp_func)(q->cmp_func_ctx, cert);
if (ret != 0) if (ret != 0)
return 0; return 0;
} }