zsh-workers
 help / color / mirror / code / Atom feed
* zftp does not work
@ 2001-06-14 10:20 Andrej Borsenkow
  2001-06-14 17:47 ` Mads Martin Jørgensen
  2001-06-15 12:55 ` Andrej Borsenkow
  0 siblings, 2 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-06-14 10:20 UTC (permalink / raw)
  To: ZSH Workers Mailing List

I do not when it happened; I guess I have not tried zftp for a long time.

bor@itsrm2% zftp open localhost
zftp open: address length mismatch
zftp open: connect failed: invalid argument

in tcp.c (zsh_getipnodebyname):

        if(zsh_inet_pton(af, name, nbuf) == 1) {
                zsh_inet_ntop(af, nbuf, pbuf, sizeof(pbuf));
                ahe.h_name = pbuf;
                ahe.h_aliases = addrlist+1;
                ahe.h_addrtype = af;
                ahe.h_length = (af == AF_INET) ? 4 : 16;
                ahe.h_addr_list = addrlist;
                return &ahe;
        }
        he = zsh_gethostbyname2(name, af);

zsh_inet_pton here finally does
  return (dst->s_addr = inet_addr(src)) != INADDR_NONE;

i.e. it returns 1 and h_length is set to 4; and later in zftp.c:

            salen = sizeof(struct sockaddr_in);
...
            if(salen != zhostp->h_length)
                zwarnnam(name, "address length mismatch", NULL, 0);

But struct sockaddr_in is

struct sockaddr_in {
        sa_family_t     sin_family;
        ushort_t        sin_port;
        struct  in_addr sin_addr;
        char    sin_zero[8];
};

and in no case can be 4.

-andrej


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

* Re: zftp does not work
  2001-06-14 10:20 zftp does not work Andrej Borsenkow
@ 2001-06-14 17:47 ` Mads Martin Jørgensen
  2001-06-14 18:47   ` Peter Stephenson
  2001-06-15 12:55 ` Andrej Borsenkow
  1 sibling, 1 reply; 5+ messages in thread
From: Mads Martin Jørgensen @ 2001-06-14 17:47 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: ZSH Workers Mailing List

* Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> [Jun 14. 2001 03:20]:
> I do not when it happened; I guess I have not tried zftp for a long time.

It have to have happened after 4.0.1, since it's working fine here with
that version. Fine is maybe a little too much since completion is
broken:

_zftp:31: command not found: zfcd_match

-- 
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic and
totally illogic, with just a little bit more effort."
                                -- A. P. J.


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

* Re: zftp does not work
  2001-06-14 17:47 ` Mads Martin Jørgensen
@ 2001-06-14 18:47   ` Peter Stephenson
  2001-06-14 19:53     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2001-06-14 18:47 UTC (permalink / raw)
  To: Zsh hackers list

Mads Martin =?iso-8859-1?Q?J=F8rgensen?= wrote:
> * Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> [Jun 14. 2001 03:20]:
> > I do not when it happened; I guess I have not tried zftp for a long time.
> 
> It have to have happened after 4.0.1, since it's working fine here with
> that version. Fine is maybe a little too much since completion is
> broken:
> 
> _zftp:31: command not found: zfcd_match

Have you run zfinit?  It gets autoloaded from there, along with the rest of
the zftp function suite.  The problem is this is independent of the
completion function suite.  Actually, the real problem is I was too lazy to
fold zftp completion properly into _zftp and left it in the functions used
by old-style completion.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, 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] 5+ messages in thread

* Re: zftp does not work
  2001-06-14 18:47   ` Peter Stephenson
@ 2001-06-14 19:53     ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2001-06-14 19:53 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> Mads Martin =?iso-8859-1?Q?J=F8rgensen?= wrote:
> > _zftp:31: command not found: zfcd_match
> 
> Have you run zfinit?  It gets autoloaded from there, along with the rest of
> the zftp function suite.

This should make things simpler; the functions are supposed to be installed
with zftp, so should be available for loading.

This makes zfinit load the tcp module as well, the alternative being
the shell crashes until we get the dependencies fixed.

The first part of this (the second hunk below) is a candidate for 4.0.2.

Index: Functions/Zftp/zfinit
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zftp/zfinit,v
retrieving revision 1.1.1.13
diff -u -r1.1.1.13 zfinit
--- Functions/Zftp/zfinit	2000/01/24 09:33:11	1.1.1.13
+++ Functions/Zftp/zfinit	2001/06/14 19:46:43
@@ -1,6 +1,9 @@
 emulate -L zsh
 
-[[ $1 = -n ]] || zmodload -e zsh/zftp || zmodload -ia zsh/zftp zftp || return 1
+if [[ $1 != -n ]]; then
+   zmodload -i zsh/net/tcp || return 1
+   zmodload -ia zsh/zftp zftp || return 1
+fi
 
 if zmodload -i zsh/zutil; then
   local arr
Index: Completion/Zsh/Command/_zftp
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zftp,v
retrieving revision 1.1
diff -u -r1.1 _zftp
--- Completion/Zsh/Command/_zftp	2001/04/02 11:33:06	1.1
+++ Completion/Zsh/Command/_zftp	2001/06/14 19:46:43
@@ -28,11 +28,13 @@
 case $subcom in
   *(cd|ls|dir))
     # complete remote directories
+    [[ -z ${functions[zfcd_match]} ]] && autoload -U zfcd_match
     _tags directories && zfcd_match $PREFIX $SUFFIX
     ;;
 
   *(get(|at)|gcp|delete|remote))
     # complete remote files
+    [[ -z ${functions[zfget_match]} ]] && autoload -U zfget_match
     _tags files && zfget_match $PREFIX $SUFFIX
     ;;
 
-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, 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] 5+ messages in thread

* RE: zftp does not work
  2001-06-14 10:20 zftp does not work Andrej Borsenkow
  2001-06-14 17:47 ` Mads Martin Jørgensen
@ 2001-06-15 12:55 ` Andrej Borsenkow
  1 sibling, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-06-15 12:55 UTC (permalink / raw)
  To: ZSH Workers Mailing List

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]


>
> bor@itsrm2% zftp open localhost
> zftp open: address length mismatch
> zftp open: connect failed: invalid argument
>

I am not exactly sure why we want to check it, but at least let's do it te
right way. The len parameter in tcp_connect was wrong as well.

-andrej

[-- Attachment #2: zsh-tcp.diff --]
[-- Type: application/octet-stream, Size: 2320 bytes --]

Index: Src/Modules/zftp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v
retrieving revision 1.16
diff -u -r1.16 zftp.c
--- Src/Modules/zftp.c	2001/06/12 15:57:26	1.16
+++ Src/Modules/zftp.c	2001/06/15 12:54:11
@@ -1699,7 +1699,7 @@
     struct hostent *zhostp = NULL;
     char **addrp, *fname;
     int err, len, tmout;
-    int herrno, af, salen;
+    int herrno, af, hlen;
 
     if (!*args) {
 	if (zfsess->userparams)
@@ -1777,11 +1777,11 @@
 	zfsess->control.peer.a.sa_family = af;
 #ifdef SUPPORT_IPV6
 	if(af == AF_INET6) {
-	    salen = sizeof(struct sockaddr_in6);
+	    hlen = 16;
 	} else
 #endif /* SUPPORT_IPV6 */
 	{
-	    salen = sizeof(struct sockaddr_in);
+	    hlen = 4;
 	}
 
 	tcp_socket(af, SOCK_STREAM, 0, &(zfsess->control));
@@ -1805,7 +1805,7 @@
 
 	/* try all possible IP's */
 	for (addrp = zhostp->h_addr_list; err && *addrp; addrp++) {
-	    if(salen != zhostp->h_length)
+	    if(hlen != zhostp->h_length)
 		zwarnnam(name, "address length mismatch", NULL, 0);
 	    do {
 		err = tcp_connect(&(zfsess->control), *addrp, zhostp, zservp->s_port);
Index: Src/Modules/tcp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.3
diff -u -r1.3 tcp.c
--- Src/Modules/tcp.c	2001/06/12 15:57:26	1.3
+++ Src/Modules/tcp.c	2001/06/15 12:54:11
@@ -255,6 +255,7 @@
 mod_export int
 tcp_connect(Tcp_session sess, char *addrp, struct hostent *zhost, int d_port)
 {
+    int salen;
 #ifdef SUPPORT_IPV6
     if(zhost->h_addrtype==AF_INET6) {
 	memcpy(&(sess->peer.in6.sin6_addr), addrp, zhost->h_length);
@@ -263,14 +264,16 @@
 # ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
 	sess->peer.in6.sin6_scope_id = 0;
 # endif
+	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;
+	salen = sizeof(struct sockaddr_in);
     }
 
-    return connect(sess->fd, (struct sockaddr *)&(sess->peer), zhost->h_length);
+    return connect(sess->fd, (struct sockaddr *)&(sess->peer), salen);
 }
 
 /* The load/unload routines required by the zsh library interface */

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

end of thread, other threads:[~2001-06-15 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 10:20 zftp does not work Andrej Borsenkow
2001-06-14 17:47 ` Mads Martin Jørgensen
2001-06-14 18:47   ` Peter Stephenson
2001-06-14 19:53     ` Peter Stephenson
2001-06-15 12:55 ` Andrej Borsenkow

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).