foreach (filter_param_t *param, filter->params) {
switch (param->type) {
- case ATK_PATH:
- path = param->value;
- break;
-
- case ATK_PREFIX:
- prefix = param->value;
- break;
-
- case ATK_LOOKUP_BY_HOST:
- config->lookup_by_host = (atoi(param->value) != 0);
- break;
-
- case ATK_RETRY_WINDOW:
- config->retry_window = atoi(param->value);
- break;
-
- case ATK_CLIENT_AWL:
- config->client_awl = atoi(param->value);
- break;
+ FILTER_PARAM_PARSE_STRING(PATH, path);
+ FILTER_PARAM_PARSE_STRING(PREFIX, prefix);
+ FILTER_PARAM_PARSE_BOOLEAN(LOOKUP_BY_HOST, config->lookup_by_host);
+ FILTER_PARAM_PARSE_INT(RETRY_WINDOW, config->retry_window);
+ FILTER_PARAM_PARSE_INT(CLIENT_AWL, config->client_awl);
default: break;
}
const query_t *query)
{
const greylist_config_t *config = filter->data;
+ if (query->state != SMTP_RCPT) {
+ syslog(LOG_WARNING, "greylisting only works as smtpd_recipient_restrictions");
+ return HTK_ABORT;
+ }
+
return try_greylist(config, query->sender, query->client_address,
query->client_name, query->recipient) ?
HTK_WHITELIST : HTK_GREYLIST;
greylist_filter);
/* Hooks.
*/
+ (void)filter_hook_register(type, "abort");
(void)filter_hook_register(type, "error");
(void)filter_hook_register(type, "greylist");
(void)filter_hook_register(type, "whitelist");