Merge remote-tracking branch 'origin/fastpath'

* origin/fastpath:
  Update documentation for builtin types
  Adding an identifier to the SMTP blocklist notices for duplicate suppression.
  Doc fixes for signature 'eval' conditions.
  Remove orphaned unit tests.
  Add type checking for signature 'eval' condition functions.
This commit is contained in:
Robin Sommer 2012-08-23 11:58:50 -07:00
commit 6dd43ea017
17 changed files with 121 additions and 44 deletions

View file

@ -126,6 +126,23 @@ RuleConditionEval::RuleConditionEval(const char* func)
rules_error("unknown identifier", func);
return;
}
if ( id->Type()->Tag() == TYPE_FUNC )
{
// Validate argument quantity and type.
FuncType* f = id->Type()->AsFuncType();
if ( f->YieldType()->Tag() != TYPE_BOOL )
rules_error("eval function type must yield a 'bool'", func);
TypeList tl;
tl.Append(internal_type("signature_state")->Ref());
tl.Append(base_type(TYPE_STRING));
if ( ! f->CheckArgs(tl.Types()) )
rules_error("eval function parameters must be a 'signature_state' "
"and a 'string' type", func);
}
}
bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,