Module: sip-router
Branch: master
Commit: d9d008e34130f2e85e3df78580e589f98f8c447a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d9d008e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sat Jul 4 21:10:36 2009 +0200
tm: fix cloning parsed uri for to/from headers
- parsed structure was not cloned
- several fields in struct uri were not cloned
---
modules/tm/sip_msg.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/modules/tm/sip_msg.c b/modules/tm/sip_msg.c
index 6b31eb0..65c2ac8 100644
--- a/modules/tm/sip_msg.c
+++ b/modules/tm/sip_msg.c
@@ -288,6 +288,24 @@ static void uri_trans(char *new_buf, char *org_buf, struct sip_uri
*uri)
uri->port.s=translate_pointer(new_buf,org_buf,uri->port.s);
uri->params.s=translate_pointer(new_buf,org_buf,uri->params.s);
uri->headers.s=translate_pointer(new_buf,org_buf,uri->headers.s);
+ /* parameters */
+ uri->transport.s=translate_pointer(new_buf,org_buf,uri->transport.s);
+ uri->ttl.s=translate_pointer(new_buf,org_buf,uri->ttl.s);
+ uri->user_param.s=translate_pointer(new_buf,org_buf,uri->user_param.s);
+ uri->maddr.s=translate_pointer(new_buf,org_buf,uri->maddr.s);
+ uri->method.s=translate_pointer(new_buf,org_buf,uri->method.s);
+ uri->lr.s=translate_pointer(new_buf,org_buf,uri->lr.s);
+ uri->r2.s=translate_pointer(new_buf,org_buf,uri->r2.s);
+ /* values */
+ uri->transport_val.s
+ =translate_pointer(new_buf,org_buf,uri->transport_val.s);
+ uri->ttl_val.s=translate_pointer(new_buf,org_buf,uri->ttl_val.s);
+ uri->user_param_val.s
+ =translate_pointer(new_buf,org_buf,uri->user_param_val.s);
+ uri->maddr_val.s=translate_pointer(new_buf,org_buf,uri->maddr_val.s);
+ uri->method_val.s=translate_pointer(new_buf,org_buf,uri->method_val.s);
+ uri->lr_val.s=translate_pointer(new_buf,org_buf,uri->lr_val.s);
+ uri->r2_val.s=translate_pointer(new_buf,org_buf,uri->r2_val.s);
}
@@ -685,6 +703,10 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int
*sip_msg_len )
((struct to_body*)new_hdr->parsed)->tag_value.s =
translate_pointer( new_msg->buf , org_msg->buf ,
((struct to_body*)hdr->parsed)->tag_value.s );
+ if ( (((struct to_body*)new_hdr->parsed)->parsed_uri.user.s)
+ || (((struct to_body*)new_hdr->parsed)->parsed_uri.host.s) )
+ uri_trans(new_msg->buf, org_msg->buf,
+ &((struct to_body*)new_hdr->parsed)->parsed_uri);
/*to params*/
to_prm = ((struct to_body*)(hdr->parsed))->param_lst;
for(;to_prm;to_prm=to_prm->next) {