0,
NULL
},
+ {
+ "action",
+ handle_metric_action,
+ 0,
+ NULL
+ },
NULL_ATTR
},
NULL_ATTR
}
gboolean
+handle_metric_action (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset)
+{
+ struct metric *metric = ctx->section_pointer;
+
+ if (g_ascii_strcasecmp (data, "reject") == 0) {
+ metric->action = METRIC_ACTION_REJECT;
+ }
+ else if (g_ascii_strcasecmp (data, "greylist") == 0) {
+ metric->action = METRIC_ACTION_GREYLIST;
+ }
+ else if (g_ascii_strcasecmp (data, "add_header") == 0) {
+ metric->action = METRIC_ACTION_ADD_HEADER;
+ }
+ else {
+ msg_err ("unknown action for metric: %s", data);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean
handle_metric_symbol (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset)
{
char *strval, *err;
gboolean worker_handle_bind (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset);
gboolean handle_metric_symbol (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset);
+gboolean handle_metric_action (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset);
gboolean handle_module_opt (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, int offset);
return FALSE;
}
p2 = cur->data;
- if (fuzzy_compare_hashes (p1->fuzzy, p2->fuzzy) >= threshold) {
+ if (fuzzy_compare_hashes (p1->fuzzy, p2->fuzzy) <= threshold) {
return TRUE;
}
}
} reply;
};
+typedef void (*greylist_cb_t) (gboolean greylisted, struct worker_task *task, gpointer ud);
#endif
}
cur = g_list_next (cur);
}
+ if (r == 0) {
+ return TRUE;
+ }
return rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}
cur = g_list_next (cur);
}
+ if (r == 0) {
+ return TRUE;
+ }
+
return rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}