Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sieve_eval_bc:B_REDIRECT make the function reentrant #5020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sieve/bc_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ int sieve_eval_bc(sieve_execute_t *exe, int *impl_keep_p, sieve_interp_t *i,
const char *bymode = cmd.u.r.bymode;
const char *dsn_notify = cmd.u.r.dsn_notify;
const char *dsn_ret = cmd.u.r.dsn_ret;
const char *deliverby = NULL;
char *deliverby = NULL;
struct buf *headers = NULL;

if (requires & BFE_VARIABLES) {
Expand Down Expand Up @@ -1972,10 +1972,10 @@ int sieve_eval_bc(sieve_execute_t *exe, int *impl_keep_p, sieve_interp_t *i,
by-mode = "N" / "R" ; "Notify" or "Return"
by-trace = "T" ; "Trace"
*/
static char by_value[14];
snprintf(by_value, sizeof(by_value), "%+ld;%c%s",
sec, toupper(bymode[0]), cmd.u.r.bytrace ? "T" : "");
deliverby = by_value;
struct buf by_value = BUF_INITIALIZER;
buf_printf(&by_value, "%+ld;%c%s",
sec, toupper(bymode[0]), cmd.u.r.bytrace ? "T" : "");
deliverby = buf_release(&by_value);
}

if (i->edited_headers) i->getheadersection(m, &headers);
Expand Down
3 changes: 2 additions & 1 deletion sieve/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int do_fileinto(sieve_interp_t *i, void *sc,
*
* incompatible with: [e]reject
*/
int do_redirect(action_list_t *a, const char *addr, const char *deliverby,
int do_redirect(action_list_t *a, const char *addr, char *deliverby,
const char *dsn_notify, const char *dsn_ret,
int is_ext_list, int cancel_keep, struct buf *headers)
{
Expand Down Expand Up @@ -620,6 +620,7 @@ void free_action_list(action_list_t *a)

case ACTION_REDIRECT:
buf_destroy(a->u.red.headers);
free(a->u.red.deliverby);
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion sieve/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int do_fileinto(sieve_interp_t *i, void *sc,
action_list_t *a, const char *mbox, const char *specialuse,
unsigned flags, const char *mailboxid,
strarray_t *imapflags, struct buf *headers);
int do_redirect(action_list_t *a, const char *addr, const char *deliverby,
int do_redirect(action_list_t *a, const char *addr, char *deliverby,
const char *dsn_notify, const char *dsn_ret,
int is_ext_list, int cancel_keep, struct buf *headers);
int do_keep(sieve_interp_t *i, void *sc, unsigned flags,
Expand Down
2 changes: 1 addition & 1 deletion sieve/sieve_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ typedef struct sieve_cal_context {
typedef struct sieve_redirect_context {
const char *addr;
int is_ext_list :1;
const char *deliverby;
char *deliverby;
const char *dsn_notify;
const char *dsn_ret;
struct buf *headers;
Expand Down
Loading