rename to be more consistent, export for teting

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22679 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-03-14 14:52:48 +00:00
parent 90c30290de
commit 00f8b507cb
4 changed files with 15 additions and 10 deletions

View File

@@ -2920,7 +2920,7 @@ _hx509_query_match_cert(hx509_context context, const hx509_query *q, hx509_cert
if (ret) if (ret)
return 0; return 0;
ret = _hx509_eval_expr(context, env, q->expr); ret = _hx509_expr_eval(context, env, q->expr);
hx509_env_free(&env); hx509_env_free(&env);
if (ret == 0) if (ret == 0)
return 0; return 0;

View File

@@ -156,7 +156,7 @@ eval_comp(hx509_context context, hx509_env env, struct hx_expr *expr)
} }
int int
_hx509_eval_expr(hx509_context context, hx509_env env, struct hx_expr *expr) _hx509_expr_eval(hx509_context context, hx509_env env, struct hx_expr *expr)
{ {
switch (expr->op) { switch (expr->op) {
case op_TRUE: case op_TRUE:
@@ -164,13 +164,13 @@ _hx509_eval_expr(hx509_context context, hx509_env env, struct hx_expr *expr)
case op_FALSE: case op_FALSE:
return 0; return 0;
case op_NOT: case op_NOT:
return ! _hx509_eval_expr(context, env, expr->arg1); return ! _hx509_expr_eval(context, env, expr->arg1);
case op_AND: case op_AND:
return _hx509_eval_expr(context, env, expr->arg1) && return _hx509_expr_eval(context, env, expr->arg1) &&
_hx509_eval_expr(context, env, expr->arg2); _hx509_expr_eval(context, env, expr->arg2);
case op_OR: case op_OR:
return _hx509_eval_expr(context, env, expr->arg1) || return _hx509_expr_eval(context, env, expr->arg1) ||
_hx509_eval_expr(context, env, expr->arg2); _hx509_expr_eval(context, env, expr->arg2);
case op_COMP: case op_COMP:
return eval_comp(context, env, expr->arg1); return eval_comp(context, env, expr->arg1);
default: default:

View File

@@ -67,16 +67,18 @@ main(int argc, char **argv)
if (expr == NULL) if (expr == NULL)
errx(1, "_hx509_expr_parse failed for %d: %s", i, foo[i].str); errx(1, "_hx509_expr_parse failed for %d: %s", i, foo[i].str);
val = _hx509_eval_expr(context, env, expr); val = _hx509_expr_eval(context, env, expr);
if (foo[i].val) { if (foo[i].val) {
if (val == 0) if (val == 0)
errx(1, "_hx509_eval_expr not true when it should: %d: %s", errx(1, "_hx509_expr_eval not true when it should: %d: %s",
i, foo[i].str); i, foo[i].str);
} else { } else {
if (val) if (val)
errx(1, "_hx509_eval_expr true when it should not: %d: %s", errx(1, "_hx509_expr_eval true when it should not: %d: %s",
i, foo[i].str); i, foo[i].str);
} }
_hx509_expr_free(expr);
} }
hx509_env_free(&env); hx509_env_free(&env);

View File

@@ -222,6 +222,9 @@ HEIMDAL_X509_1.0 {
_hx509_cert_assign_key; _hx509_cert_assign_key;
_hx509_cert_private_key; _hx509_cert_private_key;
_hx509_name_from_Name; _hx509_name_from_Name;
_hx509_expr_free;
_hx509_expr_eval;
_hx509_expr_parse;
# pkcs11 symbols # pkcs11 symbols
C_GetFunctionList; C_GetFunctionList;
local: local: