Subject: new fwtk release?

From: Gerd Schering <[email-masked]>
Date: Tue, 14 Nov 2000 09:22:27 +0100

Hi,

I remember some couple of week ago there was a discussion
about the license of the TIS fwtk and thereby the idea of a new
release of the fwtk.
Is this work in progress or is it no longer actual?

Gerd
------------------------------------------------------
-- Gerd Schering
-- Email: [email-masked]
------------------------------------------------------

---

From: Tony Gale <[email-masked]>
Date: Tue, 14 Nov 2000 08:58:48 -0000 (GMT)

[To be removed from this list send the message "unsubscribe fwtk-users" in the
BODY of a mail message to [email-masked].]

To perhaps get some impetence going (rather than impotence), I'll
post my current patch kit a little later, when I have ten minutes to
sort it out.

-tony

> Is this work in progress or is it no longer actual?

---
E-Mail: Tony Gale <[email-masked]>
Many Myths are based on truth
		-- Spock, "The Way to Eden",  stardate 5832.3

The views expressed above are entirely those of the writer
and do not represent the views, policy or understanding of
any other person or official body.

---

From: [email-masked]
Date: Tue, 14 Nov 2000 15:16:38 +0300

-----BEGIN PGP SIGNED MESSAGE-----

nuqneH,

Yep. I rewrote the library implemeting full API compatibility. I expect it
will be ready for release soon after some code audit and debugging as well 
as new API that will (should) make proxy development easier.

Gerd Schering <[email-masked]> said :

> This is a cryptographically signed message in MIME format.
> 
> --------------ms5A10E4D40C7FD750E0AC00E8
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> Hi,
> 

                                     _     _  _  _  _      _  _
 {::} {::} {::}  CU in Hell          _| o |_ | | _|| |   / _||_|   |_ |_ |_
 (##) (##) (##)        /Arkan#iD    |_  o  _||_| _||_| /   _|  | o |_||_||_|
 [||] [||] [||]            Do i believe in Bible? Hell,man,i've seen one!

---

From: Tony Gale <[email-masked]>
Date: Tue, 14 Nov 2000 14:42:51 -0000 (GMT)

Patch kit attached. Doesn't include smap, as that is pretty well
covered by Ted (et al) elsewhere and I don't use it.

Included:

o http-gw: complete list of URL escape characters, as per RFC1738
o http-gw: accommodate FTP servers that don't need a username/password
o http-gw: be less stringent about \r handling - for FTP servers
o http-gw: try and send messages in a single packet, fixes broken FTP
servers
o http-gw: allow for browsers that send CRLF on POST commands (they
do this for backwards compatibility)
o http-gw: javascript quoting bug
o x-gw: correct debug messages
o x-gw: fix potential format bug overflow
o x-gw: fix dereference-after-free bug

This covers *at least* the following FAQ patch sections (plus a few
other things):
1.3
1.6
1.7
1.8
1.9
2.8

Have fun,

-tony

---
E-Mail: Tony Gale <[email-masked]>
Have you locked your file cabinet?

The views expressed above are entirely those of the writer
and do not represent the views, policy or understanding of
any other person or official body.
diff -ur ../fwtk.dist/fwtk/http-gw/auth.c fwtk/http-gw/auth.c
--- ../fwtk.dist/fwtk/http-gw/auth.c	Fri Nov 22 16:21:05 1996
+++ fwtk/http-gw/auth.c	Tue Nov 14 13:47:47 2000
@@ -23,7 +23,10 @@
 };
 
 struct res_chars	res_chars[] = {
-	{ TYPE_HTTP, "()%:+/;?=&\r\n"},
+	/* Do not unescape "reserved", "unsafe" or "special" characters from RFC1738
+	 * TRG - 20000714
+	 */
+	{ TYPE_HTTP, ";/?:@=&$-_.+!*'(), <>\"#%{}|\\^~[]`\r\n"},
 	{ 0, NULL}
 };
 
diff -ur ../fwtk.dist/fwtk/http-gw/ftp.c fwtk/http-gw/ftp.c
--- ../fwtk.dist/fwtk/http-gw/ftp.c	Sat Jan 18 20:17:37 1997
+++ fwtk/http-gw/ftp.c	Tue Nov 14 13:47:47 2000
@@ -216,6 +216,7 @@
 int ftp_setup(sockfd, rfd, ftp_listen)
 int sockfd, rfd, *ftp_listen;
 {	int siteinfo = ftp_siteinfo;
+	int reply;
 
 	ftp_siteinfo = -1;
 	if( get_ftp_reply(rfd) != '2')
@@ -225,19 +226,24 @@
 		say(rfd,"USER anonymous");
 	else
 		say(rfd, ftp_user);
-	if( get_ftp_reply(rfd) != '3')
-		goto broken;
-
-	if( ftp_pass[0] == '\0')
-		sprintf(ftp_reply_buf,"PASS http-gw@%s", ourname);
-	else
-		strcpy(ftp_reply_buf, ftp_pass);
-	say(rfd, ftp_reply_buf);
+	reply = get_ftp_reply(rfd);
+	if (reply != '2') {
+		if( reply != '3')
+			goto broken;
 
-	ftp_siteinfo = siteinfo;
+		if( ftp_pass[0] == '\0')
+			sprintf(ftp_reply_buf,"PASS http-gw@%s", ourname);
+		else
+			strcpy(ftp_reply_buf, ftp_pass);
+		say(rfd, ftp_reply_buf);
 
-	if( get_ftp_reply(rfd) != '2')
-		goto broken;
+		ftp_siteinfo = siteinfo;
+	
+		if( get_ftp_reply(rfd) != '2')
+			goto broken;
+	} else {
+		ftp_siteinfo = siteinfo;
+	}
 
 	if( ftp_repcnt > 2){
 		ftp_gensitedir = 1;
diff -ur ../fwtk.dist/fwtk/http-gw/hmain.c fwtk/http-gw/hmain.c
--- ../fwtk.dist/fwtk/http-gw/hmain.c	Fri Feb  6 23:32:16 1998
+++ fwtk/http-gw/hmain.c	Tue Nov 14 14:06:27 2000
@@ -857,13 +857,10 @@
 		if(html_read(fd,(char *)&buf[x],1) != 1)
 			goto done;
 
-		/* get \r\n - read a char and throw it away */
-		if(buf[x] == '\r') {
+                /* eat all \r from the stream */
+                while(buf[x] == '\r') {
 			if(html_read(fd,(char *)&buf[x],1) != 1)
 				goto done;
-			buf[x] = '\0';
-			ret = x;
-			goto done;
 		}
 
 		if(buf[x] == '\n') {
@@ -945,9 +942,24 @@
 char	*s;
 int	n;
 {
-	if(net_write(fd,s,n) != n)
-		return(1);
-	return(net_write(fd,"\r\n",2) != 2);
+	char *buff;
+	int retval;
+
+	/* Attempt to send message in one packet
+	 * Some FTP servers don't like split messages
+	 * TRG - 20001114
+	 */
+	if ( (buff = malloc(n+2)) == NULL) {
+		if(net_write(fd,s,n) != n)
+			return(1);
+		return(net_write(fd,"\r\n",2) != 2);
+	}
+	memcpy(buff, s, n);
+	buff[n]='\r';
+	buff[n+1]='\n';
+	retval = net_write(fd,buff,n+2);
+	free(buff);
+	return(retval);
 }

diff -ur ../fwtk.dist/fwtk/http-gw/http-gw.c fwtk/http-gw/http-gw.c
--- ../fwtk.dist/fwtk/http-gw/http-gw.c	Fri Feb  6 23:32:25 1998
+++ fwtk/http-gw/http-gw.c	Tue Nov 14 14:19:17 2000
@@ -1362,6 +1362,22 @@
 				}else
 					break;
 			}
+			/* Check if there is a CRLF left in the buffer.
+			 * Netscape sends CRLF on the end of POST commands.
+			 * TRG - 19990817
+			 */
+			{
+			  char str[2];
+			  int count;
+			  if (ioctl(rfd, FIONREAD, &count) == 0) {
+				if (count == 2) {
+					if (recv(rfd, str, 2, MSG_PEEK) == 2) {
+						if ((str[0] == '\r') && (str[1] == '\n'))
+							read(rfd, str, 2);
+					}
+				}
+			  }
+			}
 		}
 		return 0;
 	}
@@ -2285,8 +2301,13 @@
 				    seek_and_destroy(value);
 
 			/* Quote at end removed to avoid double write*/
-			p = value + strlen(value) - 1;
-			if ((*p == '"') || (*p == '\'')) *p = 0;
+                        if (*value == '"' || *value == '\'') { 
+                           /* leave single quote intact */ 
+                           if (strlen(value) > 1) { 
+                             char *p2 = value + strlen(value) - 1; 
+                             if (*value == *p2) *p2 = 0; 
+                           } 
+                        } 
 
 			/* write out the saved (or rewritten) field now */
 			if (!in_blocked)
diff -ur ../fwtk.dist/fwtk/x-gw/fwd.c fwtk/x-gw/fwd.c
--- ../fwtk.dist/fwtk/x-gw/fwd.c	Tue Jul 22 15:05:01 1997
+++ fwtk/x-gw/fwd.c	Tue Nov 14 13:53:09 2000
@@ -30,8 +30,9 @@
 
 	if( maxb <=0 ) return bsize;
 	switch( cnt=read(*rfd,&pbuf[bsize],maxb) ) {
-		case -1: sprintf(buf,"read fd:%d",readfd);  
+		case -1: sprintf(buf,"read fd:%d",*rfd);  
 			 pmsg(buf,1);
+			 /* FALL THROUGH */
 		case  0: clear_close_fd(*rfd,rset,wset);
 			 cnt= -1;
 			 break;
@@ -51,8 +52,9 @@
 	int	cnt;
 
 	switch( (cnt=write(*wfd,pbuf,bsize)) ) {
-		case -1: sprintf(buf,"write fd:%d",readfd);
+		case -1: sprintf(buf,"write fd:%d",*wfd);
 			 pmsg(buf,1);
+			 /* FALL THROUGH */
 		case  0: clear_close_fd(*wfd,rset,wset);
 			 return -1;
 		default: if(cnt<bsize) {
diff -ur ../fwtk.dist/fwtk/x-gw/pmsg.c fwtk/x-gw/pmsg.c
--- ../fwtk.dist/fwtk/x-gw/pmsg.c	Tue Jul 22 15:04:33 1997
+++ fwtk/x-gw/pmsg.c	Tue Nov 14 13:59:24 2000
@@ -37,9 +37,9 @@
 	buf[sizeof(buf)-1] = '\0';
    }
 
-   if( uselog ) syslog( LLEV, buf );
+   if( uselog ) syslog( LLEV, "%s", buf );
    else {
-       fprintf( stderr, buf );
+       fprintf( stderr, "%s", buf );
        fflush(stderr);
    }
 }
diff -ur ../fwtk.dist/fwtk/x-gw/sig.c fwtk/x-gw/sig.c
--- ../fwtk.dist/fwtk/x-gw/sig.c	Fri Feb  6 00:10:56 1998
+++ fwtk/x-gw/sig.c	Tue Nov 14 13:47:47 2000
@@ -83,13 +83,18 @@
 {
 	int	ret;
 	list_t	*p=pidlist;
+	list_t	*ptemp;
 
 	while(p) { 
 		if( (ret=handle_sigpid(p->id))>= -1 && cb) 
 			ret=cb(p->id,data,ret);
-		if( ret>= -1) 
+		if( ret>= -1) {
+			ptemp=p->next;
 			pidlist=(list_t*)deleteListItem(pidlist,p->id);
-	p=p->next;
+			p=ptemp;
+                } else {
+			p=p->next;
+		}
 	} 
 	return pidlist;
 }

---

From: Ted Keller <[email-masked]>
Date: Thu, 16 Nov 2000 13:07:47 -0500 (EST)

Rick,

Sometime back, you offered to coordinate a new fwtk release.  Are you
still able to do that?

ted keller

---

From: Rick Murphy <[email-masked]>
Date: Thu, 16 Nov 2000 20:51:59 -0500

>Sometime back, you offered to coordinate a new fwtk release.  Are you
Not for the next few weeks, but I'm hoping to get something done around the 
holidays.
It remains to be seen if NAI will host a new distribution or not.
         -Rick