Module: sip-router
Branch: master
Commit: 88f03cb2cf50ee0b09fda8b3c4c4651553ddd176
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=88f03cb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Jan 2 16:10:40 2011 +0100
dialplan: fix matching string comparison op
- the return code was tested as for match of regexp, which led to
mismatches for str comparison
- credits to Jordan Levy
---
modules/dialplan/dp_repl.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules/dialplan/dp_repl.c b/modules/dialplan/dp_repl.c
index 2b8454c..265b507 100644
--- a/modules/dialplan/dp_repl.c
+++ b/modules/dialplan/dp_repl.c
@@ -316,21 +316,23 @@ search_rule:
case EQUAL_OP:
LM_DBG("equal operator testing\n");
- if(rulep->match_exp.len != input.len)
+ if(rulep->match_exp.len != input.len) {
rez = -1;
- else
+ } else {
rez = strncmp(rulep->match_exp.s,input.s,input.len);
- break;
+ rez = (rez==0)?0:-1;
+ }
+ break;
default:
- LM_ERR("bogus match operator code %i\n", rulep->matchop);
+ LM_ERR("bogus match operator code %i\n", rulep->matchop);
return -1;
}
if(rez >= 0)
- goto repl;
+ goto repl;
}
- /*test the rules with len 0*/
- if(indexp->len){
+ /*test the rules with len 0*/
+ if(indexp->len){
for(indexp = indexp->next; indexp!=NULL; indexp = indexp->next)
if(!indexp->len)
break;