summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormikeh <mikeh@FreeBSD.org>2002-04-26 16:51:03 +0000
committermikeh <mikeh@FreeBSD.org>2002-04-26 16:51:03 +0000
commit7d2926215db2c27174d1971f7ff00e4dd4bdb3da (patch)
tree47564d9a62abca3c7bf6a1314e3da6fe4766465d /contrib
parent8213b19eecbd2f635c175fa1ecf97750fda29782 (diff)
parent0b76460f54e4e596f9810014e7e76f6536a7a8c1 (diff)
downloadFreeBSD-src-7d2926215db2c27174d1971f7ff00e4dd4bdb3da.zip
FreeBSD-src-7d2926215db2c27174d1971f7ff00e4dd4bdb3da.tar.gz
This commit was generated by cvs2svn to compensate for changes in r95504,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/lukemftp/src/fetch.c2
-rw-r--r--contrib/lukemftp/src/ftp.110
-rw-r--r--contrib/lukemftp/src/ftp.c20
-rw-r--r--contrib/lukemftp/src/ftp_var.h1
-rw-r--r--contrib/lukemftp/src/main.c13
5 files changed, 32 insertions, 14 deletions
diff --git a/contrib/lukemftp/src/fetch.c b/contrib/lukemftp/src/fetch.c
index dfb1c0c..c38e90d 100644
--- a/contrib/lukemftp/src/fetch.c
+++ b/contrib/lukemftp/src/fetch.c
@@ -617,7 +617,7 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
error = getaddrinfo(host, NULL, &hints, &res0);
diff --git a/contrib/lukemftp/src/ftp.1 b/contrib/lukemftp/src/ftp.1
index d4ca1b3..83bff62 100644
--- a/contrib/lukemftp/src/ftp.1
+++ b/contrib/lukemftp/src/ftp.1
@@ -77,7 +77,7 @@
Internet file transfer program
.Sh SYNOPSIS
.Nm ""
-.Op Fl AadefginpRtvV
+.Op Fl 46AadefginpRtvV
.Bk -words
.Op Fl o Ar output
.Ek
@@ -146,6 +146,14 @@ below for more information.
Options may be specified at the command line, or to the
command interpreter.
.Bl -tag -width "port "
+.It Fl 4
+Forces
+.Nm
+to only use IPv4 addresses.
+.It Fl 6
+Forces
+.Nm
+to only use IPv6 addresses.
.It Fl A
Force active mode ftp.
By default,
diff --git a/contrib/lukemftp/src/ftp.c b/contrib/lukemftp/src/ftp.c
index b627b2b..b340e85 100644
--- a/contrib/lukemftp/src/ftp.c
+++ b/contrib/lukemftp/src/ftp.c
@@ -149,7 +149,7 @@ hookup(char *host, char *port)
memset(&hints, 0, sizeof(hints));
portnum = parseport(port, FTP_PORT);
hints.ai_flags = AI_CANONNAME;
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
error = getaddrinfo(host, NULL, &hints, &res0);
@@ -453,9 +453,10 @@ getreply(int expecteof)
if (dig > 4 && pflag == 1 && isdigit(c))
pflag = 2;
if (pflag == 2) {
- if (c != '\r' && c != ')')
- *pt++ = c;
- else {
+ if (c != '\r' && c != ')') {
+ if (pt < &pasv[sizeof(pasv) - 1])
+ *pt++ = c;
+ } else {
*pt = '\0';
pflag = 3;
}
@@ -689,7 +690,7 @@ sendrequest(const char *cmd, const char *local, const char *remote,
rc = -1;
switch (curtype) {
case TYPE_A:
- rc = fseek(fin, (long) restart_point, SEEK_SET);
+ rc = fseeko(fin, restart_point, SEEK_SET);
break;
case TYPE_I:
case TYPE_L:
@@ -1134,18 +1135,17 @@ recvrequest(const char *cmd, const char *local, const char *remote,
case TYPE_A:
if (is_retr && restart_point) {
int ch;
- long i, n;
+ off_t i;
- if (fseek(fout, 0L, SEEK_SET) < 0)
+ if (fseeko(fout, (off_t)0, SEEK_SET) < 0)
goto done;
- n = (long)restart_point;
- for (i = 0; i++ < n;) {
+ for (i = 0; i++ < restart_point;) {
if ((ch = getc(fout)) == EOF)
goto done;
if (ch == '\n')
i++;
}
- if (fseek(fout, 0L, SEEK_CUR) < 0) {
+ if (fseeko(fout, (off_t)0, SEEK_CUR) < 0) {
done:
warn("local: %s", local);
goto cleanuprecv;
diff --git a/contrib/lukemftp/src/ftp_var.h b/contrib/lukemftp/src/ftp_var.h
index ac69638..2e4ed1c 100644
--- a/contrib/lukemftp/src/ftp_var.h
+++ b/contrib/lukemftp/src/ftp_var.h
@@ -279,6 +279,7 @@ GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
GLOBAL char remotepwd[MAXPATHLEN]; /* remote dir */
GLOBAL char *username; /* name of user logged in as. (dynamic) */
+GLOBAL sa_family_t family; /* address family to use for connections */
GLOBAL char *ftpport; /* port number to use for FTP connections */
GLOBAL char *httpport; /* port number to use for HTTP connections */
GLOBAL char *gateport; /* port number to use for gateftp connections */
diff --git a/contrib/lukemftp/src/main.c b/contrib/lukemftp/src/main.c
index d28a08f..3fae56e 100644
--- a/contrib/lukemftp/src/main.c
+++ b/contrib/lukemftp/src/main.c
@@ -171,6 +171,7 @@ main(int argc, char *argv[])
upload_path = NULL;
isupload = 0;
reply_callback = NULL;
+ family = AF_UNSPEC;
/*
* Get the default socket buffer sizes if we don't already have them.
@@ -255,8 +256,16 @@ main(int argc, char *argv[])
}
}
- while ((ch = getopt(argc, argv, "Aadefgino:pP:r:RtT:u:vV")) != -1) {
+ while ((ch = getopt(argc, argv, "46Aadefgino:pP:r:RtT:u:vV")) != -1) {
switch (ch) {
+ case '4':
+ family = AF_INET;
+ break;
+
+ case '6':
+ family = AF_INET6;
+ break;
+
case 'A':
activefallback = 0;
passivemode = 0;
@@ -956,7 +965,7 @@ void
usage(void)
{
(void)fprintf(stderr,
-"usage: %s [-AadefginpRtvV] [-o outfile] [-P port] [-r retry]\n"
+"usage: %s [-46AadefginpRtvV] [-o outfile] [-P port] [-r retry]\n"
" [-T dir,max[,inc][[user@]host [port]]] [host:path[/]]\n"
" [file:///file] [ftp://[user[:pass]@]host[:port]/path[/]]\n"
" [http://[user[:pass]@]host[:port]/path] [...]\n"
OpenPOWER on IntegriCloud