Module: sip-router
Branch: 3.1
Commit: 4d5a004b2bb78fa8bf9bb4b603b085d04dee5519
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4d5a004…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Apr 25 11:45:12 2011 +0200
rls(k): few fixes
- string comparison that fails because sometimes one of the strings
is '\0' terminated and the other never is.
- fix for when some non-RLS SUBSCRIBEs are not identified as such.
- fix for a small typo in an error diagnostic.
- patch by Peter Dunkley
(cherry picked from commit 2917d848a0ede8b7285a2f8414d43fcd4262f6e3)
---
modules_k/rls/subscribe.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index f667379..c1efbd9 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -90,7 +90,7 @@ xmlNodePtr rls_get_by_service_uri(xmlDocPtr doc, str* uri)
val = XMLNodeGetAttrContentByName(node, "uri");
if(val!=NULL)
{
- if((uri->len==strlen(val)) && (strcmp(val, uri->s)==0))
+ if((uri->len==strlen(val)) && (strncmp(val, uri->s, uri->len)==0))
{
xmlFree(val);
return node;
@@ -241,13 +241,17 @@ int rls_get_service_list(str *service_uri, str *user, str *domain,
*service_node = rls_get_by_service_uri(xmldoc, service_uri);
if(*service_node==NULL)
{
- LM_ERR("service uri %.*s not found in rl document for user"
+ LM_DBG("service uri %.*s not found in rl document for user"
" sip:%.*s@%.*s\n", service_uri->len, service_uri->s,
user->len, user->s, domain->len, domain->s);
- goto error;
+ rootdoc = NULL;
+ if(xmldoc!=NULL)
+ xmlFreeDoc(xmldoc);
+ }
+ else
+ {
+ *rootdoc = xmldoc;
}
-
- *rootdoc = xmldoc;
rls_dbf.free_result(rls_db, result);
if(xcapdoc!=NULL)
@@ -621,7 +625,7 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2)
if(send_full_notify(&subs, service_node, subs.version, &subs.pres_uri,
hash_code)<0)
{
- LM_ERR("failed sending full state sotify\n");
+ LM_ERR("failed sending full state notify\n");
goto error;
}
/* send subscribe requests for all in the list */