diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/acl.c | 11 | ||||
-rw-r--r-- | src/src/expand.c | 15 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/src/acl.c b/src/src/acl.c index d0db7171e..5cd0c3507 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -3873,23 +3873,28 @@ acl_check_wargs(int where, address_item *addr, uschar *s, int level, uschar **user_msgptr, uschar **log_msgptr) { uschar * tmp; +uschar * tmp_arg[9]; /* must match acl_arg[] */ uschar * name; +int i; if (!(tmp = string_dequote(&s)) || !(name = expand_string(tmp))) goto bad; -for (acl_narg = 0; acl_narg < sizeof(acl_arg)/sizeof(*acl_arg); acl_narg++) +for (i = 0; i < 9; i++) { while (*s && isspace(*s)) s++; if (!*s) break; - if (!(tmp = string_dequote(&s)) || !(acl_arg[acl_narg] = expand_string(tmp))) + if (!(tmp = string_dequote(&s)) || !(tmp_arg[i] = expand_string(tmp))) { tmp = name; goto bad; } } +acl_narg = i; +for (i = 0; i < acl_narg; i++) acl_arg[i] = tmp_arg[i]; +while (i < 9) acl_arg[i++] = NULL; -return acl_check_internal(where, addr, name, level+1, user_msgptr, log_msgptr); +return acl_check_internal(where, addr, name, level, user_msgptr, log_msgptr); bad: if (expand_string_forcedfail) return ERROR; diff --git a/src/src/expand.c b/src/src/expand.c index 60552a85c..767e4771a 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1855,7 +1855,7 @@ uschar *dummy_log_msg; for (i = 1; i < nsub && sub[i]; i++) acl_arg[i-1] = sub[i]; acl_narg = i-1; -while (i < sizeof(sub)/sizeof(*sub)) +while (i < nsub) acl_arg[i++ - 1] = NULL; DEBUG(D_expand) @@ -2111,11 +2111,13 @@ switch(cond_type) */ case ECOND_ACL: - /* ${if acl {{name}{arg1}{arg2}...} {yes}{no}} + /* ${if acl {{name}{arg1}{arg2}...} {yes}{no}} */ { uschar *nameargs; uschar *user_msg; BOOL cond = FALSE; + int size = 0; + int ptr = 0; while (isspace(*s)) s++; if (*s++ != '{') goto COND_FAILED_CURLY_START; @@ -2129,16 +2131,17 @@ switch(cond_type) case 3: return NULL; } - if (yield != NULL) - switch(eval_acl(sub, sizeof(sub)/sizeof(*sub), &user_msg)) + if (yield != NULL) switch(eval_acl(sub, sizeof(sub)/sizeof(*sub), &user_msg)) { case OK: cond = TRUE; case FAIL: + lookup_value = NULL; if (user_msg) + { lookup_value = string_cat(NULL, &size, &ptr, user_msg, Ustrlen(user_msg)); - else - lookup_value = NULL; + lookup_value[ptr] = '\0'; + } *yield = cond; break; |