zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: tcp socket handling
@ 2002-04-25 13:16 Peter Stephenson
  2002-04-25 14:03 ` PATCH: zftp data handling Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2002-04-25 13:16 UTC (permalink / raw)
  To: Zsh hackers list

Found a bug when trying to get IPv6 to work.  There could be more, since
although I can connect to the server it's giving odd responses which it
doesn't when I use IPv4.

The other change is simply a change of logic, since peer.in and peer.a are
alternative members of a union.  Actually, the family is (has to be) in
the same place in all forms of sockaddr, but I like the look of it the
new way.

Index: Src/Modules/tcp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.22
diff -u -r1.22 tcp.c
--- Src/Modules/tcp.c	18 Apr 2002 11:39:15 -0000	1.22
+++ Src/Modules/tcp.c	25 Apr 2002 13:12:28 -0000
@@ -322,13 +322,14 @@
 # ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
 	sess->peer.in6.sin6_scope_id = 0;
 # endif
+	sess->peer.in6.sin6_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in6);
     } else
 #endif /* SUPPORT_IPV6 */
     {
 	memcpy(&(sess->peer.in.sin_addr), addrp, zhost->h_length);
 	sess->peer.in.sin_port = d_port;
-	sess->peer.a.sa_family = zhost->h_addrtype;
+	sess->peer.in.sin_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in);
     }
 

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: zftp data handling
  2002-04-25 13:16 PATCH: tcp socket handling Peter Stephenson
@ 2002-04-25 14:03 ` Peter Stephenson
  2002-04-25 14:56   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2002-04-25 14:03 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> Found a bug when trying to get IPv6 to work.  There could be more, since
> although I can connect to the server it's giving odd responses which it
> doesn't when I use IPv4.

There are a couple of typos in the handling of port commands.
Given these are presumably fatal I suppose there wasn't kit around to
test it on at the time, so three small errors is pretty good going.  I
won't guarantee it's all A1, but it does seem to do the basics now.

Index: Src/Modules/zftp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v
retrieving revision 1.25
diff -u -r1.25 zftp.c
--- Src/Modules/zftp.c	18 Apr 2002 11:39:16 -0000	1.25
+++ Src/Modules/zftp.c	25 Apr 2002 14:00:10 -0000
@@ -863,7 +863,7 @@
 	zwarnnam(name, "Must set preference S or P to transfer data", NULL, 0);
 	return 1;
     }
-    zfsess->dfd = socket(AF_INET, SOCK_STREAM, 0);
+    zfsess->dfd = socket(zfsess->control->peer.a.sa_family, SOCK_STREAM, 0);
     if (zfsess->dfd < 0) {
 	zwarnnam(name, "can't get data socket: %e", NULL, errno);
 	return 1;
@@ -907,7 +907,7 @@
 	    delim = ptr[1];
 	    if(delim < 33 || delim > 126 || ptr[2] != delim || ptr[3] != delim)
 		goto bad_epsv;
-	    ptr += 3;
+	    ptr += 4;
 	    end = strchr(ptr, delim);
 	    if(!end || end[1] != ')')
 		goto bad_epsv;

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: zftp data handling
  2002-04-25 14:03 ` PATCH: zftp data handling Peter Stephenson
@ 2002-04-25 14:56   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2002-04-25 14:56 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> Peter Stephenson wrote:
> > Found a bug when trying to get IPv6 to work.  There could be more, since
> > although I can connect to the server it's giving odd responses which it
> > doesn't when I use IPv4.
> 
> There are a couple of typos in the handling of port commands.

(By `port' I really meant `passive'.)

The second fix (17041) applies to 4.0, the first (17040) doesn't (the
bug seems to have been introduced as port a deliberate change at some
point since 4.0).

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-25 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-25 13:16 PATCH: tcp socket handling Peter Stephenson
2002-04-25 14:03 ` PATCH: zftp data handling Peter Stephenson
2002-04-25 14:56   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).