Module: sip-router Branch: 3.1 Commit: 8d122fe2f57775079c17e68159e1a6d2001d6194 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8d122fe2...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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 (cherry picked from commit 88f03cb2cf50ee0b09fda8b3c4c4651553ddd176)
---
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 5831f36..f647122 100644 --- a/modules/dialplan/dp_repl.c +++ b/modules/dialplan/dp_repl.c @@ -312,21 +312,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;