|
1 Index: modules/registrar/save.c |
|
2 diff -Nau modules/registrar/save.c.orig modules/registrar/save.c |
|
3 --- modules/registrar/save.c.orig 2008-03-07 14:12:56.307895000 +0100 |
|
4 +++ modules/registrar/save.c 2008-03-08 00:03:02.436987000 +0100 |
|
5 @@ -51,6 +51,7 @@ |
|
6 #include "../../ut.h" |
|
7 #include "../../qvalue.h" |
|
8 #include "../../dset.h" |
|
9 +#include "../../msg_translator.h" |
|
10 #ifdef USE_TCP |
|
11 #include "../../tcp_server.h" |
|
12 #endif |
|
13 @@ -687,9 +688,28 @@ |
|
14 contact_t* c; |
|
15 int st; |
|
16 str aor; |
|
17 + unsigned int new_len = 0; |
|
18 + struct sip_msg* sip_manip = 0; |
|
19 |
|
20 rerrno = R_FINE; |
|
21 |
|
22 + /* make a cheap shallow copy of the incoming message */ |
|
23 + sip_manip = (void*)pkg_malloc(sizeof(struct sip_msg)); |
|
24 + if (sip_manip==0) { |
|
25 + LM_ERR("no more pkg memory\n"); |
|
26 + goto error; |
|
27 + } |
|
28 + memcpy(sip_manip,_m,sizeof(struct sip_msg)); |
|
29 + |
|
30 + /* incorporate changes made to the routing script so far, */ |
|
31 + /* this mean that the so called 'lumps' will be processed */ |
|
32 + sip_manip->buf = build_res_buf_from_sip_res(_m, &new_len); |
|
33 + sip_manip->len = new_len; |
|
34 + |
|
35 + /* from here on, use the new refreshed message data as */ |
|
36 + /* specifically manipulated according to the user's wish */ |
|
37 + _m = sip_manip; /* only safe when passing by value */ |
|
38 + |
|
39 if (parse_message(_m) < 0) { |
|
40 goto error; |
|
41 } |
|
42 Don't forget to free(3) the pkg_alloc(3) memory!!! |