Browse code

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 authored on 02/01/2011 15:10:40
Showing 1 changed files
... ...
@@ -304,21 +304,23 @@ search_rule:
304 304
 
305 305
 			case EQUAL_OP:
306 306
 				LM_DBG("equal operator testing\n");
307
-			    if(rulep->match_exp.len != input.len)
307
+			    if(rulep->match_exp.len != input.len) {
308 308
 					rez = -1;
309
-			    else 
309
+				} else {
310 310
 					rez = strncmp(rulep->match_exp.s,input.s,input.len);
311
-		    break;
311
+					rez = (rez==0)?0:-1;
312
+				}
313
+			break;
312 314
 	    
313 315
 			default:
314
-			    LM_ERR("bogus match operator code %i\n", rulep->matchop);
316
+				LM_ERR("bogus match operator code %i\n", rulep->matchop);
315 317
 				return -1;
316 318
 		}
317 319
 		if(rez >= 0)
318
-		    goto repl;
320
+			goto repl;
319 321
 	}
320
-    /*test the rules with len 0*/
321
-    if(indexp->len){
322
+	/*test the rules with len 0*/
323
+	if(indexp->len){
322 324
 		for(indexp = indexp->next; indexp!=NULL; indexp = indexp->next)
323 325
 			if(!indexp->len)
324 326
 				break;