Module Name: src
Committed By: riz
Date: Thu Nov 5 05:26:38 UTC 2015
Modified Files:
src/usr.bin/ftp [netbsd-7]: fetch.c ftp.1 main.c ssl.c ssl.h version.h
Log Message:
Pull up following revision(s) (requested by wiz in ticket #981):
usr.bin/ftp/ftp.1: revision 1.135
usr.bin/ftp/ssl.c: revision 1.3
usr.bin/ftp/ssl.c: revision 1.4
usr.bin/ftp/ssl.h: revision 1.3
usr.bin/ftp/version.h: revision 1.86
usr.bin/ftp/version.h: revision 1.87
usr.bin/ftp/fetch.c: revision 1.207
usr.bin/ftp/main.c: revision 1.123
Add -x xferbufsize to set xferbuf size.
Implement -x xferbufsize set the socket send and receive buffer size,
as per 'xferbuf' in interactive mode.
Patch from Nicholas Mills (via private mail), with minor adjustment by me.
Add Server Name Indication (SNI) support for https.
Needed for e.g. some github URLs.
Bump version for SNI support.
servername cannot be NULL here.
Noted by joerg@.
To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1 -r1.205.4.2 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.134 -r1.134.8.1 src/usr.bin/ftp/ftp.1
cvs rdiff -u -r1.122 -r1.122.8.1 src/usr.bin/ftp/main.c
cvs rdiff -u -r1.2 -r1.2.14.1 src/usr.bin/ftp/ssl.c
cvs rdiff -u -r1.2 -r1.2.4.1 src/usr.bin/ftp/ssl.h
cvs rdiff -u -r1.84.6.1 -r1.84.6.2 src/usr.bin/ftp/version.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.205.4.1 src/usr.bin/ftp/fetch.c:1.205.4.2
--- src/usr.bin/ftp/fetch.c:1.205.4.1 Sun Oct 26 16:47:12 2014
+++ src/usr.bin/ftp/fetch.c Thu Nov 5 05:26:38 2015
@@ -1,7 +1,7 @@
-/* $NetBSD: fetch.c,v 1.205.4.1 2014/10/26 16:47:12 martin Exp $ */
+/* $NetBSD: fetch.c,v 1.205.4.2 2015/11/05 05:26:38 riz Exp $ */
/*-
- * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -10,6 +10,9 @@
* This code is derived from software contributed to The NetBSD Foundation
* by Scott Aaron Bamford.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Thomas Klausner.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -34,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.205.4.1 2014/10/26 16:47:12 martin Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.205.4.2 2015/11/05 05:26:38 riz Exp $");
#endif /* not lint */
/*
@@ -782,7 +785,7 @@ fetch_url(const char *url, const char *p
#ifdef WITH_SSL
if (urltype == HTTPS_URL_T) {
- if ((ssl = fetch_start_ssl(s)) == NULL) {
+ if ((ssl = fetch_start_ssl(s, host)) == NULL) {
close(s);
s = -1;
continue;
Index: src/usr.bin/ftp/ftp.1
diff -u src/usr.bin/ftp/ftp.1:1.134 src/usr.bin/ftp/ftp.1:1.134.8.1
--- src/usr.bin/ftp/ftp.1:1.134 Sat Dec 22 16:57:10 2012
+++ src/usr.bin/ftp/ftp.1 Thu Nov 5 05:26:38 2015
@@ -1,6 +1,6 @@
-.\" $NetBSD: ftp.1,v 1.134 2012/12/22 16:57:10 christos Exp $
+.\" $NetBSD: ftp.1,v 1.134.8.1 2015/11/05 05:26:38 riz Exp $
.\"
-.\" Copyright (c) 1996-2010 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1996-2015 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@@ -57,7 +57,7 @@
.\"
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
.\"
-.Dd December 22, 2012
+.Dd April 24, 2015
.Dt FTP 1
.Os
.Sh NAME
@@ -84,6 +84,7 @@
.Xc
.Oc
.Ek
+.Op Fl x Ar xferbufsize
.Bk -words
.\" [[user@]host [port]]
.Oo
@@ -311,6 +312,12 @@ Forces
.Nm
to show all responses from the remote server, as well
as report on data transfer statistics.
+.It Fl x Ar xferbufsize
+Set the size of the socket send and receive buffers to
+.Ar xferbufsize .
+Refer to
+.Ic xferbuf
+for more information.
.El
.Pp
The client host with which
Index: src/usr.bin/ftp/main.c
diff -u src/usr.bin/ftp/main.c:1.122 src/usr.bin/ftp/main.c:1.122.8.1
--- src/usr.bin/ftp/main.c:1.122 Sat Dec 22 16:57:10 2012
+++ src/usr.bin/ftp/main.c Thu Nov 5 05:26:38 2015
@@ -1,7 +1,7 @@
-/* $NetBSD: main.c,v 1.122 2012/12/22 16:57:10 christos Exp $ */
+/* $NetBSD: main.c,v 1.122.8.1 2015/11/05 05:26:38 riz Exp $ */
/*-
- * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2015 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -91,14 +91,14 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\
The Regents of the University of California. All rights reserved.\
- Copyright 1996-2008 The NetBSD Foundation, Inc. All rights reserved");
+ Copyright 1996-2015 The NetBSD Foundation, Inc. All rights reserved");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: main.c,v 1.122 2012/12/22 16:57:10 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.122.8.1 2015/11/05 05:26:38 riz Exp $");
#endif
#endif /* not lint */
@@ -266,7 +266,7 @@ main(int volatile argc, char **volatile
}
}
- while ((ch = getopt(argc, argv, "46AadefginN:o:pP:q:r:Rs:tT:u:vV")) != -1) {
+ while ((ch = getopt(argc, argv, "46AadefginN:o:pP:q:r:Rs:tT:u:vVx:")) != -1) {
switch (ch) {
case '4':
family = AF_INET;
@@ -408,6 +408,13 @@ main(int volatile argc, char **volatile
progress = verbose = 0;
break;
+ case 'x':
+ sndbuf_size = strsuftoi(optarg);
+ if (sndbuf_size < 1)
+ errx(1, "Bad xferbuf value: %s", optarg);
+ rcvbuf_size = sndbuf_size;
+ break;
+
default:
usage();
}
@@ -1045,7 +1052,7 @@ usage(void)
(void)fprintf(stderr,
"usage: %s [-46AadefginpRtVv] [-N netrc] [-o outfile] [-P port] [-q quittime]\n"
-" [-r retry] [-s srcaddr] [-T dir,max[,inc]]\n"
+" [-r retry] [-s srcaddr] [-T dir,max[,inc]] [-x xferbufsize]\n"
" [[user@]host [port]] [host:path[/]] [file:///file]\n"
" [ftp://[user[:pass]@]host[:port]/path[/]]\n"
" [http://[user[:pass]@]host[:port]/path] [...]\n"
Index: src/usr.bin/ftp/ssl.c
diff -u src/usr.bin/ftp/ssl.c:1.2 src/usr.bin/ftp/ssl.c:1.2.14.1
--- src/usr.bin/ftp/ssl.c:1.2 Mon Dec 24 22:12:28 2012
+++ src/usr.bin/ftp/ssl.c Thu Nov 5 05:26:38 2015
@@ -1,8 +1,9 @@
-/* $NetBSD: ssl.c,v 1.2 2012/12/24 22:12:28 christos Exp $ */
+/* $NetBSD: ssl.c,v 1.2.14.1 2015/11/05 05:26:38 riz Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008, 2010 Joerg Sonnenberger <[email protected]>
+ * Copyright (c) 2015 Thomas Klausner <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ssl.c,v 1.2 2012/12/24 22:12:28 christos Exp $");
+__RCSID("$NetBSD: ssl.c,v 1.2.14.1 2015/11/05 05:26:38 riz Exp $");
#endif
#include <time.h>
@@ -545,7 +546,7 @@ fetch_getline(struct fetch_connect *conn
}
void *
-fetch_start_ssl(int sock)
+fetch_start_ssl(int sock, const char *servername)
{
SSL *ssl;
SSL_CTX *ctx;
@@ -569,6 +570,11 @@ fetch_start_ssl(int sock)
return NULL;
}
SSL_set_fd(ssl, sock);
+ if (!SSL_set_tlsext_host_name(ssl, servername)) {
+ fprintf(ttyout, "SSL hostname setting failed\n");
+ SSL_CTX_free(ctx);
+ return NULL;
+ }
while ((ret = SSL_connect(ssl)) == -1) {
ssl_err = SSL_get_error(ssl, ret);
if (ssl_err != SSL_ERROR_WANT_READ &&
Index: src/usr.bin/ftp/ssl.h
diff -u src/usr.bin/ftp/ssl.h:1.2 src/usr.bin/ftp/ssl.h:1.2.4.1
--- src/usr.bin/ftp/ssl.h:1.2 Tue Jan 7 02:07:08 2014
+++ src/usr.bin/ftp/ssl.h Thu Nov 5 05:26:38 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ssl.h,v 1.2 2014/01/07 02:07:08 joerg Exp $ */
+/* $NetBSD: ssl.h,v 1.2.4.1 2015/11/05 05:26:38 riz Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@ ssize_t fetch_read(void *, size_t, size_
char *fetch_getln(char *, int, struct fetch_connect *);
int fetch_getline(struct fetch_connect *, char *, size_t, const char **);
void fetch_set_ssl(struct fetch_connect *, void *);
-void *fetch_start_ssl(int);
+void *fetch_start_ssl(int, const char *);
#else /* !WITH_SSL */
Index: src/usr.bin/ftp/version.h
diff -u src/usr.bin/ftp/version.h:1.84.6.1 src/usr.bin/ftp/version.h:1.84.6.2
--- src/usr.bin/ftp/version.h:1.84.6.1 Fri Oct 31 08:30:06 2014
+++ src/usr.bin/ftp/version.h Thu Nov 5 05:26:38 2015
@@ -1,7 +1,7 @@
-/* $NetBSD: version.h,v 1.84.6.1 2014/10/31 08:30:06 martin Exp $ */
+/* $NetBSD: version.h,v 1.84.6.2 2015/11/05 05:26:38 riz Exp $ */
/*-
- * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999-2015 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -34,5 +34,5 @@
#endif
#ifndef FTP_VERSION
-#define FTP_VERSION "20141026"
+#define FTP_VERSION "20150912"
#endif