Browse Source

- fixed 2 parse_via ipv6 reference parsing bugs:
- replies didn't include terminatig ']' (thanks Jens):
this was due to not including [] in the hostname; now
they are included (hopefully no other piece of code relies
on not having them :-))
- ipv6 references starting with : where not parsed
(e.g.: [::1]).

Andrei Pelinescu-Onciul 22 years ago
parent
commit
d5f3a5fb90
3 changed files with 10 additions and 13 deletions
  1. 1 1
      Makefile.defs
  2. 1 0
      TODO
  3. 8 12
      parser/parse_via.c

+ 1 - 1
Makefile.defs

@@ -40,7 +40,7 @@ export makefile_defs
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 8
 PATCHLEVEL = 8
 SUBLEVEL =   12
 SUBLEVEL =   12
-EXTRAVERSION = dev-t09
+EXTRAVERSION = dev-t10
 
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 1 - 0
TODO

@@ -3,6 +3,7 @@ $Id$
 ( - todo, x - done)
 ( - todo, x - done)
 
 
 release:
 release:
+- check via ipv6 fixes and backport to stable
 x fix kill(0, SIGTERM) on startup error (will kill also the launching shell
 x fix kill(0, SIGTERM) on startup error (will kill also the launching shell
  if non-interactive)
  if non-interactive)
 - fix modules destroy (some modules will try to free uninitialized resources
 - fix modules destroy (some modules will try to free uninitialized resources

+ 8 - 12
parser/parse_via.c

@@ -67,7 +67,7 @@ enum {
 	L_PARAM, F_PARAM, P_PARAM,
 	L_PARAM, F_PARAM, P_PARAM,
 	L_VIA, F_VIA,
 	L_VIA, F_VIA,
 	F_COMMENT, P_COMMENT,
 	F_COMMENT, P_COMMENT,
-	F_IP6HOST, P_IP6HOST,
+	F_IP6HOST, P_IP6HOST, 
 	F_CRLF,
 	F_CRLF,
 	F_LF,
 	F_LF,
 	F_CR,
 	F_CR,
@@ -1332,13 +1332,10 @@ parse_again:
 					case F_COMMENT:
 					case F_COMMENT:
 					case P_COMMENT:
 					case P_COMMENT:
 						break;
 						break;
-					case F_IP6HOST: /*eat the spaces*/
-						break;
+					case F_IP6HOST: /*no spaces allowed*/
 					case P_IP6HOST:
 					case P_IP6HOST:
-						/*mark end of host*/
-						vb->host.len=tmp-vb->host.s;
-						state=L_PORT; 
-						break;
+						LOG(L_ERR, "ERROR:parse_via: bad ipv6 reference\n");
+						goto error;
 					case F_CRLF:
 					case F_CRLF:
 					case F_LF:
 					case F_LF:
 					case F_CR:
 					case F_CR:
@@ -1446,9 +1443,8 @@ parse_again:
 				switch(state){
 				switch(state){
 					case F_HOST:
 					case F_HOST:
 					case F_IP6HOST:
 					case F_IP6HOST:
-						LOG(L_ERR,"ERROR:parse_via:"
-							" no host found\n");
-						goto error;
+						state=P_IP6HOST;
+						break;
 					case P_IP6HOST:
 					case P_IP6HOST:
 						break;
 						break;
 					case P_HOST:
 					case P_HOST:
@@ -1712,6 +1708,7 @@ parse_again:
 			case '[':
 			case '[':
 				switch(state){
 				switch(state){
 					case F_HOST:
 					case F_HOST:
+						vb->host.s=tmp; /* mark start here (include [])*/
 						state=F_IP6HOST;
 						state=F_IP6HOST;
 						break;
 						break;
 					case F_COMMENT:/*everything is allowed in a comment*/
 					case F_COMMENT:/*everything is allowed in a comment*/
@@ -1736,7 +1733,7 @@ parse_again:
 				switch(state){
 				switch(state){
 					case P_IP6HOST:
 					case P_IP6HOST:
 						/*mark the end*/
 						/*mark the end*/
-						vb->host.len=tmp-vb->host.s;
+						vb->host.len=(tmp-vb->host.s)+1; /* include "]" */
 						state=L_PORT;
 						state=L_PORT;
 						break;
 						break;
 					case F_CRLF:
 					case F_CRLF:
@@ -1851,7 +1848,6 @@ parse_again:
 						break;
 						break;
 					case F_IP6HOST:
 					case F_IP6HOST:
 						state=P_IP6HOST;
 						state=P_IP6HOST;
-						vb->host.s=tmp;
 						break;
 						break;
 					case P_IP6HOST:
 					case P_IP6HOST:
 						break;
 						break;