25 #include <stringprep.h>
45 #define AMP_TRIGGERED 1
46 #define AMP_INVALID_RULE 2
47 #define AMP_INVALID_CONDITION 3
48 #define AMP_INVALID_ACTION 4
49 #define AMP_INVALID_VALUE 5
50 #define AMP_NOT_ACCEPTABLE 6
64 while (rule_c != NULL) {
68 rule_tmp = rule_c->
next;
75 if (!pkt || !rule)
return NULL;
144 rule_c->action = strdup(
"drop");
147 rule_c->action = strdup(
"alert");
150 rule_c->action = strdup(
"error");
153 rule_c->action = strdup(
"notify");
155 if (!rule_c->action) {
164 rule_c->condition = strdup(
"deliver");
168 rule_c->value = strdup(
"direct");
169 if (user->
top != NULL)
175 rule_c->value = strdup(
"none");
177 && user->
top == NULL)
183 rule_c->value = strdup(
"none");
185 && user->
top == NULL)
189 if (!rule_c->value) {
197 else if (
nad_find_attr(pkt->
nad, elem, -1,
"condition",
"match-resource") >= 0
199 rule_c->condition = strdup(
"match-resource");
203 rule_c->value = strdup(
"exact");
210 rule_c->value = strdup(
"any");
211 if (user->
top == NULL)
217 rule_c->value = strdup(
"other");
222 if (!rule_c->value) {
232 rule_c->condition = strdup(
"expire-at");
242 else if (stamp < time(NULL))
247 if (!rule_c->condition) {
263 rule_c->next = calloc(1,
sizeof(
struct amp_rule_st));
264 rule_c = rule_c->next;
271 while (rule_c != NULL) {
272 if (rule_c->result > 0) {
275 if (!strcmp(rule_c->action,
"drop") && !errormode)
279 else if (!strcmp(rule_c->action,
"alert") && !errormode) {
286 else if (!strcmp(rule_c->action,
"error") && !errormode) {
293 else if (!strcmp(rule_c->action,
"notify") && !errormode) {
300 rule_c = rule_c->next;
336 nad_append_attr(res->nad, -1,
"name",
"Advanced Message Processing support");
382 if (mod->
init)
return 0;
388 if (option != NULL) {
393 if (option != NULL) {
398 if (option != NULL) {
403 if (option != NULL) {
408 if (option != NULL) {
413 if (option != NULL) {
418 if (option != NULL) {
419 log_debug(
ZONE,
"condition Match-Resource disabled in config.");
423 if (option != NULL) {
428 if (option != NULL) {