Browse code

- re updates

Andrei Pelinescu-Onciul authored on 20/08/2003 13:36:38
Showing 2 changed files
... ...
@@ -5,6 +5,8 @@ $Id$
5 5
 - backport tcp conn id fix to stable
6 6
 - change len_gt into and expr (e.g msg:len).
7 7
 - sipit: uri == myself doesn't match tls port = 5061
8
+- sipit: fix check_self & *_alias to work with tcp & tls
9
+- sipit: fix ipv6 references in check_self
8 10
 - regex subst on uris?
9 11
 - port receive.c pre_script_cb fix from stable
10 12
 - extend alias to include port numbers :
... ...
@@ -395,6 +395,7 @@ struct replace_lst* subst_run(struct subst_expr* se, char* input,
395 395
 	int r;
396 396
 	regmatch_t* pmatch;
397 397
 	int nmatch;
398
+	int eflags;
398 399
 	
399 400
 	
400 401
 	/* init */
... ...
@@ -408,11 +409,14 @@ struct replace_lst* subst_run(struct subst_expr* se, char* input,
408 408
 		LOG(L_ERR, "ERROR: subst_run_ out of mem. (pmatch)\n");
409 409
 		goto error;
410 410
 	}
411
+	eflags=0;
411 412
 	do{
412
-		r=regexec(se->re, p, nmatch, pmatch, 0);
413
+		r=regexec(se->re, p, nmatch, pmatch, eflags);
413 414
 		DBG("subst_run: running. r=%d\n", r);
414 415
 		/* subst */
415 416
 		if (r==0){ /* != REG_NOMATCH */
417
+			/* change eflags, not to match any more at string start */
418
+			eflags|=REG_NOTBOL;
416 419
 			*crt=pkg_malloc(sizeof(struct replace_lst));
417 420
 			if (*crt==0){
418 421
 				LOG(L_ERR, "ERROR: subst_run: out of mem (crt)\n");
... ...
@@ -425,6 +429,9 @@ struct replace_lst* subst_run(struct subst_expr* se, char* input,
425 425
 			}
426 426
 			(*crt)->offset=pmatch[0].rm_so+(int)(p-input);
427 427
 			(*crt)->size=pmatch[0].rm_eo-pmatch[0].rm_so;
428
+			DBG("subst_run: matched (%d, %d): [%.*s]\n",
429
+					(*crt)->offset, (*crt)->size, 
430
+					(*crt)->size, input+(*crt)->offset);
428 431
 			/* create subst. string */
429 432
 			/* construct the string from replace[] */
430 433
 			if (replace_build(p, nmatch, pmatch, se, msg, &((*crt)->rpl))<0){