Skip to content

Commit

Permalink
Use msg_flags instead of script level flags. Prevents unintentional c…
Browse files Browse the repository at this point in the history
…ollision with script flags which could cause calls to mc_compact and mc_compress to fail.

(cherry picked from commit 0cfb7c3)
  • Loading branch information
rrb3942 authored and liviuchircu committed Feb 6, 2023
1 parent 28f0fc9 commit 224da22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/compression/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,15 @@ static int mc_compact(struct sip_msg* msg, mc_whitelist_p wh_list, void* flags_p
goto error;
}

if (tm_api.t_gett && msg->flags&FL_TM_CB_REGISTERED)
if (tm_api.t_gett && msg->msg_flags&FL_TM_CB_REGISTERED)
goto error;

/*register tm callback if tm api */
if (tm_api.register_tmcb &&
tm_api.register_tmcb( msg, 0, TMCB_PRE_SEND_BUFFER,
wrap_tm_compact, NULL, 0) != 1) {
LM_ERR("failed to add tm TMCB_PRE_SEND_BUFFER callback\n");
msg->flags |= FL_TM_CB_REGISTERED;
msg->msg_flags |= FL_TM_CB_REGISTERED;
goto error;
}

Expand Down Expand Up @@ -1102,7 +1102,7 @@ static int mc_compress(struct sip_msg* msg, int *algo_p, int *flags_p,
goto end;
}

if (tm_api.t_gett && msg->flags&FL_TM_CB_REGISTERED) {
if (tm_api.t_gett && msg->msg_flags&FL_TM_CB_REGISTERED) {
ret = 1;
goto end;
}
Expand All @@ -1112,7 +1112,7 @@ static int mc_compress(struct sip_msg* msg, int *algo_p, int *flags_p,
tm_api.register_tmcb( msg, 0, TMCB_PRE_SEND_BUFFER,
wrap_tm_compress, NULL, 0) != 1) {
LM_ERR("failed to add tm TMCB_PRE_SEND_BUFFER callback\n");
msg->flags |= FL_TM_CB_REGISTERED;
msg->msg_flags |= FL_TM_CB_REGISTERED;
goto end;
}

Expand Down

0 comments on commit 224da22

Please sign in to comment.