Browse Source

- fixed parse via param bug on";hidden,"

Andrei Pelinescu-Onciul 23 years ago
parent
commit
9d81cbd6bf
3 changed files with 33 additions and 3 deletions
  1. 1 1
      Makefile.defs
  2. 30 0
      parse_via.c
  3. 2 2
      test/stateless.cfg

+ 1 - 1
Makefile.defs

@@ -87,7 +87,7 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DWAIT -DNEW_HNAME \
 	 -DSILENT_FR \
 	 -DNO_DEBUG \
-	 -DVERY_NOISY_REPLIES\
+	 #-DVERY_NOISY_REPLIES\
 	 #-DNOISY_REPLIES \
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \
 	 #-DNOSMP \

+ 30 - 0
parse_via.c

@@ -254,6 +254,36 @@ char* parse_via_param(	char* p, char* end, int* pstate,
 						goto endofparam;
 				}
 				break;
+			case ',':
+				switch(state){
+					case FIN_HIDDEN:
+						*tmp=0;
+						param->type=state;
+						param->name.len=tmp-param->name.s;
+						state=F_VIA;
+						goto endofvalue;
+					case FIN_BRANCH:
+					case FIN_MADDR:
+					case FIN_TTL:
+					case FIN_RECEIVED:
+						LOG(L_ERR, "ERROR: parse_via_param: new via found" 
+								"(',') when '=' expected (state %d=)\n",
+								state);
+						goto error; /* or we could ignore this bad param*/
+					case F_CR:
+					case F_LF:
+					case F_CRLF:
+						state=END_OF_HEADER;
+						goto end_via;
+					case GEN_PARAM:
+					default:
+						*tmp=0;
+						param->type=GEN_PARAM;
+						param->name.len=tmp-param->name.s;
+						state=F_VIA;
+						goto endofvalue;
+				}
+				break; 
 
 				/* param names */
 			case 'h':

+ 2 - 2
test/stateless.cfg

@@ -5,7 +5,7 @@
 #
 
 
-debug=3          # debug level (cmd line: -dddddddddd)
+debug=9          # debug level (cmd line: -dddddddddd)
 #fork=yes          # (cmd. line: -D)
 fork=yes
 fork=no
@@ -21,7 +21,7 @@ rev_dns=off      # (cmd. line: -R)
 #listen=10.0.0.179
 #listen=127.0.0.1
 #listen=192.168.57.33
-listen=192.168.57.72
+#listen=192.168.57.72
 loop_checks=0
 # for more info: sip_router -h