From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "ZSH Workers Mailing List" <zsh-workers@sunsite.dk>
Subject: RE: zftp does not work
Date: Fri, 15 Jun 2001 16:55:24 +0400 [thread overview]
Message-ID: <003c01c0f59a$7196a280$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <000a01c0f4bb$92f9f3d0$21c9ca95@mow.siemens.ru>
[-- 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 */
prev parent reply other threads:[~2001-06-15 12:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-14 10:20 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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='003c01c0f59a$7196a280$21c9ca95@mow.siemens.ru' \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).