Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/ftp Pull up following revision(s) (requested by w...



details:   https://anonhg.NetBSD.org/src/rev/63fe78bfc4e4
branches:  netbsd-7
changeset: 799635:63fe78bfc4e4
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Nov 05 05:26:38 2015 +0000

description:
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@.

diffstat:

 usr.bin/ftp/fetch.c   |  11 +++++++----
 usr.bin/ftp/ftp.1     |  13 ++++++++++---
 usr.bin/ftp/main.c    |  19 +++++++++++++------
 usr.bin/ftp/ssl.c     |  12 +++++++++---
 usr.bin/ftp/ssl.h     |   4 ++--
 usr.bin/ftp/version.h |   6 +++---
 6 files changed, 44 insertions(+), 21 deletions(-)

diffs (227 lines):

diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/fetch.c       Thu Nov 05 05:26:38 2015 +0000
@@ -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 @@
 
 #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;
diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/ftp.1
--- a/usr.bin/ftp/ftp.1 Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/ftp.1 Thu Nov 05 05:26:38 2015 +0000
@@ -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 @@
 .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
diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/main.c
--- a/usr.bin/ftp/main.c        Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/main.c        Thu Nov 05 05:26:38 2015 +0000
@@ -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 @@
                }
        }
 
-       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 @@
                        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 @@
 
        (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"
diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/ssl.c
--- a/usr.bin/ftp/ssl.c Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/ssl.c Thu Nov 05 05:26:38 2015 +0000
@@ -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 <joerg%NetBSD.org@localhost>
+ * Copyright (c) 2015 Thomas Klausner <wiz%NetBSD.org@localhost>
  * 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 @@
 }
 
 void *
-fetch_start_ssl(int sock)
+fetch_start_ssl(int sock, const char *servername)
 {
        SSL *ssl;
        SSL_CTX *ctx;
@@ -569,6 +570,11 @@
                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 &&
diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/ssl.h
--- a/usr.bin/ftp/ssl.h Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/ssl.h Thu Nov 05 05:26:38 2015 +0000
@@ -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 @@
 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 */
 
diff -r 8e4c5b38ac4a -r 63fe78bfc4e4 usr.bin/ftp/version.h
--- a/usr.bin/ftp/version.h     Thu Nov 05 05:24:11 2015 +0000
+++ b/usr.bin/ftp/version.h     Thu Nov 05 05:26:38 2015 +0000
@@ -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



Home | Main Index | Thread Index | Old Index