From 430ca62d970bd176d8314b136aef32bae2337a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 27 Jul 2005 21:45:25 +0000 Subject: [PATCH] Add HX509_QUERY_MATCH_FUNCTION that allows caller to match by function, note that this doesn't not work directly for backends that implements ->query, they must do their own processing. (I'm running out of flags, only 12 left now) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15810 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/cert.c | 5 +++++ lib/hx509/hx_locl.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/hx509/cert.c b/lib/hx509/cert.c index 62b720a73..6a2885a0f 100644 --- a/lib/hx509/cert.c +++ b/lib/hx509/cert.c @@ -1345,6 +1345,11 @@ _hx509_query_match_cert(const hx509_query *q, hx509_cert cert) if (strcasecmp(q->friendlyname, name) != 0) return 0; } + if (q->match & HX509_QUERY_MATCH_FUNCTION) { + int ret = (*q->cmp_func)(cert); + if (ret != 0) + return 0; + } if (q->match & ~HX509_QUERY_MASK) return 0; diff --git a/lib/hx509/hx_locl.h b/lib/hx509/hx_locl.h index 6d39311ae..722a5ba84 100644 --- a/lib/hx509/hx_locl.h +++ b/lib/hx509/hx_locl.h @@ -103,7 +103,8 @@ struct hx509_query_data { #define HX509_QUERY_MATCH_LOCAL_KEY_ID 0x10000 #define HX509_QUERY_NO_MATCH_PATH 0x20000 #define HX509_QUERY_MATCH_FRIENDLY_NAME 0x40000 -#define HX509_QUERY_MASK 0x7ffff +#define HX509_QUERY_MATCH_FUNCTION 0x80000 +#define HX509_QUERY_MASK 0xfffff Certificate *subject; Certificate *certificate; heim_integer *serial; @@ -113,6 +114,7 @@ struct hx509_query_data { Name *subject_name; hx509_path *path; char *friendlyname; + int (*cmp_func)(hx509_cert); }; struct hx509_keyset_ops {