"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ftp.c" between
tnftp-20151004.tar.gz and tnftp-20200705.tar.gz

About: tnftp is an enhanced ftp client (prior name "lukemftp").

ftp.c  (tnftp-20151004):ftp.c  (tnftp-20200705)
/* $NetBSD: ftp.c,v 1.19 2013/05/05 11:17:31 lukem Exp $ */ /* $NetBSD: ftp.c,v 1.22 2020/07/04 09:59:07 lukem Exp $ */
/* from NetBSD: ftp.c,v 1.164 2012/07/04 06:09:37 is Exp */ /* from NetBSD: ftp.c,v 1.169 2020/06/08 01:33:27 lukem Exp */
/*- /*-
* Copyright (c) 1996-2009 The NetBSD Foundation, Inc. * Copyright (c) 1996-2020 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
* This code is derived from software contributed to The NetBSD Foundation * This code is derived from software contributed to The NetBSD Foundation
* by Luke Mewburn. * by Luke Mewburn.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
skipping to change at line 101 skipping to change at line 101
#include "tnftp.h" #include "tnftp.h"
#include <arpa/telnet.h> #include <arpa/telnet.h>
#if 0 /* tnftp */ #if 0 /* tnftp */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else #else
__RCSID(" NetBSD: ftp.c,v 1.164 2012/07/04 06:09:37 is Exp "); __RCSID(" NetBSD: ftp.c,v 1.169 2020/06/08 01:33:27 lukem Exp ");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h> #include <sys/time.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
skipping to change at line 211 skipping to change at line 211
ai_unmapped(res); ai_unmapped(res);
if (getnameinfo(res->ai_addr, res->ai_addrlen, if (getnameinfo(res->ai_addr, res->ai_addrlen,
hname, sizeof(hname), sname, sizeof(sname), hname, sizeof(hname), sname, sizeof(sname),
NI_NUMERICHOST | NI_NUMERICSERV) != 0) { NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
strlcpy(hname, "?", sizeof(hname)); strlcpy(hname, "?", sizeof(hname));
strlcpy(sname, "?", sizeof(sname)); strlcpy(sname, "?", sizeof(sname));
} }
if (verbose && res0->ai_next) { if (verbose && res0->ai_next) {
/* if we have multiple possibilities */ /* if we have multiple possibilities */
fprintf(ttyout, "Trying %s:%s ...\n", hname, sname); #ifdef INET6
if(res->ai_family == AF_INET6) {
fprintf(ttyout, "Trying [%s]:%s ...\n", hname,
sname);
} else {
#endif
fprintf(ttyout, "Trying %s:%s ...\n", hname,
sname);
#ifdef INET6
}
#endif
} }
s = socket(res->ai_family, SOCK_STREAM, res->ai_protocol); s = socket(res->ai_family, SOCK_STREAM, res->ai_protocol);
if (s < 0) { if (s < 0) {
warn("Can't create socket for connection to `%s:%s'", warn("Can't create socket for connection to `%s:%s'",
hname, sname); hname, sname);
continue; continue;
} }
if (ftp_connect(s, res->ai_addr, res->ai_addrlen, if (ftp_connect(s, res->ai_addr, res->ai_addrlen,
verbose || !res->ai_next) < 0) { verbose || !res->ai_next) < 0) {
close(s); close(s);
skipping to change at line 1554 skipping to change at line 1564
if (sendport) { if (sendport) {
char hname[NI_MAXHOST], sname[NI_MAXSERV]; char hname[NI_MAXHOST], sname[NI_MAXSERV];
struct sockinet tmp; struct sockinet tmp;
switch (data_addr.su_family) { switch (data_addr.su_family) {
case AF_INET: case AF_INET:
if (!epsv4 || epsv4bad) { if (!epsv4 || epsv4bad) {
result = COMPLETE + 1; result = COMPLETE + 1;
break; break;
} }
/* FALLTHROUGH */
#ifdef INET6 #ifdef INET6
/* FALLTHROUGH */
case AF_INET6: case AF_INET6:
if (!epsv6 || epsv6bad) { if (!epsv6 || epsv6bad) {
result = COMPLETE + 1; result = COMPLETE + 1;
break; break;
} }
#endif #endif
af = (data_addr.su_family == AF_INET) ? 1 : 2; af = (data_addr.su_family == AF_INET) ? 1 : 2;
tmp = data_addr; tmp = data_addr;
#ifdef INET6 #ifdef INET6
if (tmp.su_family == AF_INET6) if (tmp.su_family == AF_INET6)
skipping to change at line 2048 skipping to change at line 2058
return (new); return (new);
} }
/* /*
* abort_squared -- * abort_squared --
* aborts abort_remote(). lostpeer() is called because if the user is * aborts abort_remote(). lostpeer() is called because if the user is
* too impatient to wait or there's another problem then ftp really * too impatient to wait or there's another problem then ftp really
* needs to get back to a known state. * needs to get back to a known state.
*/ */
static void static void
abort_squared(int dummy) abort_squared(int signo)
{ {
char msgbuf[100]; char msgbuf[100];
size_t len; size_t len;
sigint_raised = 1; sigint_raised = 1;
alarmtimer(0); alarmtimer(0);
len = strlcpy(msgbuf, "\nremote abort aborted; closing connection.\n", len = strlcpy(msgbuf, "\nremote abort aborted; closing connection.\n",
sizeof(msgbuf)); sizeof(msgbuf));
write(fileno(ttyout), msgbuf, len); write(fileno(ttyout), msgbuf, len);
lostpeer(0); lostpeer(signo);
siglongjmp(xferabort, 1); siglongjmp(xferabort, 1);
} }
void void
abort_remote(FILE *din) abort_remote(FILE *din)
{ {
char buf[BUFSIZ]; unsigned char buf[BUFSIZ];
int nfnd; int nfnd;
if (cout == NULL) { if (cout == NULL) {
warnx("Lost control connection for abort"); warnx("Lost control connection for abort");
if (ptabflg) if (ptabflg)
code = -1; code = -1;
lostpeer(0); lostpeer(0);
return; return;
} }
/* /*
 End of changes. 9 change blocks. 
9 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)