[sr-dev] git:kamailio_3.0: modules_k/presence and modules_k/rls Fixed parse_to() usage

Marius Zbihlei marius.zbihlei at 1and1.ro
Mon Jul 26 16:45:08 CEST 2010


Module: sip-router
Branch: kamailio_3.0
Commit: 53c179bb3042bb767c43cd1a87a2cb8ab0ea92b7
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=53c179bb3042bb767c43cd1a87a2cb8ab0ea92b7

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Mon Jul 26 17:39:18 2010 +0300

modules_k/presence and modules_k/rls Fixed parse_to() usage

In case of error parse_to returns a pointer to the last parsed character. This is not a strict
error check, as several other modules provide a relaxed way of parsing To header (the uri is still
parseable even if the TO headers are not).

---

 modules_k/presence/subscribe.c |    3 ++-
 modules_k/rls/subscribe.c      |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules_k/presence/subscribe.c b/modules_k/presence/subscribe.c
index 6ea70ae..607d0f2 100644
--- a/modules_k/presence/subscribe.c
+++ b/modules_k/presence/subscribe.c
@@ -802,7 +802,8 @@ int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int mexp,
 	else
 	{
 		memset( &TO , 0, sizeof(TO) );
-		if( !parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO))
+		parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO);
+		if( TO.uri.len <= 0 )
 		{
 			LM_DBG("'To' header NOT parsed\n");
 			goto error;
diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index bdf311f..608e6e5 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -407,7 +407,8 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2)
 	else
 	{
 		memset( &TO , 0, sizeof(TO) );
-		if( !parse_to(msg->to->body.s,msg->to->body.s+msg->to->body.len+1,&TO));
+		parse_to(msg->to->body.s,msg->to->body.s+msg->to->body.len+1,&TO);
+		if( TO.uri.len <= 0 )
 		{
 			LM_DBG("'To' header NOT parsed\n");
 			goto error;




More information about the sr-dev mailing list