Browse Source

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)
Daniel-Constantin Mierla 14 years ago
parent
commit
5392eb7f16
1 changed files with 9 additions and 7 deletions
  1. 9 7
      modules/dialplan/dp_repl.c

+ 9 - 7
modules/dialplan/dp_repl.c

@@ -304,21 +304,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;