X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/5f5be4927abaa906a25ffb295d48ee085894c388..7e3ce68e68ab9b8906a637d352993abf361554e2:/src/src/acl.c diff --git a/src/src/acl.c b/src/src/acl.c index 474b0d181..492e9bf17 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -88,6 +88,7 @@ enum { ACLC_ACL, #ifdef WITH_CONTENT_SCAN ACLC_MIME_REGEX, #endif + ACLC_QUEUE, ACLC_RATELIMIT, ACLC_RECIPIENTS, #ifdef WITH_CONTENT_SCAN @@ -108,7 +109,7 @@ enum { ACLC_ACL, ACLC_VERIFY }; /* ACL conditions/modifiers: "delay", "control", "continue", "endpass", -"message", "log_message", "log_reject_target", "logwrite", and "set" are +"message", "log_message", "log_reject_target", "logwrite", "queue" and "set" are modifiers that look like conditions but always return TRUE. They are used for their side effects. */ @@ -152,13 +153,16 @@ static uschar *conditions[] = { #ifdef WITH_CONTENT_SCAN US"mime_regex", #endif + US"queue", US"ratelimit", US"recipients", #ifdef WITH_CONTENT_SCAN US"regex", #endif US"remove_header", - US"sender_domains", US"senders", US"set", + US"sender_domains", + US"senders", + US"set", #ifdef WITH_CONTENT_SCAN US"spam", #endif @@ -298,6 +302,7 @@ static uschar cond_expand_at_top[] = { #ifdef WITH_CONTENT_SCAN TRUE, /* mime_regex */ #endif + TRUE, /* queue */ TRUE, /* ratelimit */ FALSE, /* recipients */ #ifdef WITH_CONTENT_SCAN @@ -360,6 +365,7 @@ static uschar cond_modifiers[] = { #ifdef WITH_CONTENT_SCAN FALSE, /* mime_regex */ #endif + TRUE, /* queue */ FALSE, /* ratelimit */ FALSE, /* recipients */ #ifdef WITH_CONTENT_SCAN @@ -507,6 +513,12 @@ static unsigned int cond_forbids[] = { ~(1<special_action; *basic_errno = sender_vaddr->basic_errno; @@ -2108,22 +2121,21 @@ else if (verify_sender_address != NULL) HDEBUG(D_acl) debug_printf("----------- end verify ------------\n"); - if (rc == OK) - { - if (Ustrcmp(sender_vaddr->address, verify_sender_address) != 0) - { - DEBUG(D_acl) debug_printf("sender %s verified ok as %s\n", - verify_sender_address, sender_vaddr->address); - } - else - { - DEBUG(D_acl) debug_printf("sender %s verified ok\n", - verify_sender_address); - } - } - else *basic_errno = sender_vaddr->basic_errno; + if (rc != OK) + *basic_errno = sender_vaddr->basic_errno; + else + DEBUG(D_acl) + { + if (Ustrcmp(sender_vaddr->address, verify_sender_address) != 0) + debug_printf("sender %s verified ok as %s\n", + verify_sender_address, sender_vaddr->address); + else + debug_printf("sender %s verified ok\n", + verify_sender_address); + } } - else rc = OK; /* Null sender */ + else + rc = OK; /* Null sender */ /* Cache the result code */ @@ -2976,8 +2988,6 @@ acl_check_condition(int verb, acl_condition_block *cb, int where, { uschar *user_message = NULL; uschar *log_message = NULL; -uschar *debug_tag = NULL; -uschar *debug_opts = NULL; int rc = OK; #ifdef WITH_CONTENT_SCAN int sep = -'/'; @@ -3329,24 +3339,39 @@ for (; cb != NULL; cb = cb->next) break; case CONTROL_DEBUG: - while (*p == '/') { - if (Ustrncmp(p, "/tag=", 5) == 0) - { - const uschar *pp = p + 5; - while (*pp != '\0' && *pp != '/') pp++; - debug_tag = string_copyn(p+5, pp-p-5); - p = pp; - } - else if (Ustrncmp(p, "/opts=", 6) == 0) + uschar * debug_tag = NULL; + uschar * debug_opts = NULL; + BOOL kill = FALSE; + + while (*p == '/') { - const uschar *pp = p + 6; - while (*pp != '\0' && *pp != '/') pp++; - debug_opts = string_copyn(p+6, pp-p-6); + const uschar * pp = p+1; + if (Ustrncmp(pp, "tag=", 4) == 0) + { + for (pp += 4; *pp && *pp != '/';) pp++; + debug_tag = string_copyn(p+5, pp-p-5); + } + else if (Ustrncmp(pp, "opts=", 5) == 0) + { + for (pp += 5; *pp && *pp != '/';) pp++; + debug_opts = string_copyn(p+6, pp-p-6); + } + else if (Ustrncmp(pp, "kill", 4) == 0) + { + for (pp += 4; *pp && *pp != '/';) pp++; + kill = TRUE; + } + else + while (*pp && *pp != '/') pp++; p = pp; } + + if (kill) + debug_logging_stop(); + else + debug_logging_activate(debug_tag, debug_opts); } - debug_logging_activate(debug_tag, debug_opts); break; case CONTROL_SUPPRESS_LOCAL_FIXUPS: @@ -3518,7 +3543,7 @@ for (; cb != NULL; cb = cb->next) rc = match_isinlist(dkim_cur_signer, &arg,0,NULL,NULL,MCL_STRING,TRUE,NULL); else - rc = FAIL; + rc = FAIL; break; case ACLC_DKIM_STATUS: @@ -3677,6 +3702,10 @@ for (; cb != NULL; cb = cb->next) break; #endif + case ACLC_QUEUE: + queue_name = string_copy_malloc(arg); + break; + case ACLC_RATELIMIT: rc = acl_ratelimit(arg, where, log_msgptr); break;