hx509: Show query expression parse errors
This commit is contained in:
@@ -2979,12 +2979,21 @@ hx509_query_match_expr(hx509_context context, hx509_query *q, const char *expr)
|
||||
|
||||
if (expr == NULL) {
|
||||
q->match &= ~HX509_QUERY_MATCH_EXPR;
|
||||
} else {
|
||||
q->expr = _hx509_expr_parse(expr);
|
||||
if (q->expr)
|
||||
q->match |= HX509_QUERY_MATCH_EXPR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
q->expr = _hx509_expr_parse(expr);
|
||||
if (q->expr == NULL) {
|
||||
const char *reason = _hx509_expr_parse_error();
|
||||
|
||||
hx509_set_error_string(context, 0, EINVAL,
|
||||
"Invalid certificate query match expression: "
|
||||
"%s (%s)", expr,
|
||||
reason ? reason : "syntax error");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
q->match |= HX509_QUERY_MATCH_EXPR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user