Module Name: othersrc Committed By: lukem Date: Sun May 5 13:17:06 UTC 2013
Modified Files: othersrc/usr.bin/tnftp: configure.ac tnftp.h othersrc/usr.bin/tnftp/src: Makefile.am ssl.c Log Message: Implement --enable-ssl (yes,no,auto) to enable SSL for https:// fetch. Implement --with-openssl to find OpenSSL. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 othersrc/usr.bin/tnftp/configure.ac cvs rdiff -u -r1.34 -r1.35 othersrc/usr.bin/tnftp/tnftp.h cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/tnftp/src/Makefile.am cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/usr.bin/tnftp/src/ssl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/usr.bin/tnftp/configure.ac diff -u othersrc/usr.bin/tnftp/configure.ac:1.23 othersrc/usr.bin/tnftp/configure.ac:1.24 --- othersrc/usr.bin/tnftp/configure.ac:1.23 Sun May 5 11:44:06 2013 +++ othersrc/usr.bin/tnftp/configure.ac Sun May 5 13:17:05 2013 @@ -1,4 +1,4 @@ -# $NetBSD: configure.ac,v 1.23 2013/05/05 11:44:06 lukem Exp $ +# $NetBSD: configure.ac,v 1.24 2013/05/05 13:17:05 lukem Exp $ # # Process this file with autoconf to produce a configure script. @@ -9,12 +9,13 @@ AC_COPYRIGHT([ Copyright (c) 1999-2010 The NetBSD Foundation, Inc. All rights reserved. ]) -AC_REVISION([$Revision: 1.23 $]) +AC_REVISION([$Revision: 1.24 $]) AS_SHELL_SANITIZE AC_CONFIG_SRCDIR([tnftp.h]) AC_CONFIG_AUX_DIR([buildaux]) +AC_CONFIG_MACRO_DIR([buildaux]) AC_CONFIG_HEADERS([tnftp_config.h]) AC_CONFIG_LIBOBJ_DIR([libnetbsd]) @@ -36,6 +37,12 @@ AC_ARG_ENABLE([ipv6], [default=enabled]])], [opt_ipv6=$enableval], [opt_ipv6=yes]) +AC_ARG_ENABLE([ssl], + [AS_HELP_STRING([--enable-ssl], + [enable SSL support (requires --with-openssl) + [default=auto]])], + [opt_ssl=$enableval], + [opt_ssl=auto]) AC_ARG_WITH([socks], [AS_HELP_STRING([--with-socks], [enable support for (Dante) SOCKS5 proxy @@ -49,15 +56,17 @@ AC_ARG_WITH([socks], AH_TEMPLATE([HAVE_POLL], [Define if we have poll() and it is not emulated.]) AH_TEMPLATE([HAVE_PRINTF_QD], - [Define if *printf() uses %qd to print `long long' + [Define if *printf() uses %qd to print 'long long' (otherwise uses %lld).]) AH_TEMPLATE([HAVE_PRINTF_LONG_LONG], - [Define if `long long' is supported and + [Define if 'long long' is supported and *printf() supports %lld or %qd to print them.]) AH_TEMPLATE([USE_INET6], [Define if using IPv6 support.]) AH_TEMPLATE([USE_SOCKS], [Define if using (Dante) SOCKS5 proxy.]) +AH_TEMPLATE([WITH_SSL], + [Define if enabling SSL support.]) # # Checks for programs. @@ -104,6 +113,7 @@ AC_SEARCH_LIBS([socket], [], [-lnsl])]) +# # Check for (Dante) SOCKS5. # AS_IF([test "$with_socks" != no], @@ -124,6 +134,24 @@ AS_IF([test "$with_socks" != no], with_socks=no])]) # +# Check for OpenSSL. +# +AX_CHECK_OPENSSL([have_ssl=yes]) + +AS_IF([test "$with_ssl" != no], + [AC_MSG_NOTICE([--with-ssl=$with_ssl; checking for required OpenSSL features]) + AS_IF([test "$have_ssl" == yes], + [AC_DEFINE([WITH_SSL], [1]) + AC_MSG_NOTICE([enabling SSL support]) + with_ssl=yes], + [AS_IF([test "$with_ssl" != "auto"], + [AC_MSG_FAILURE([--with-ssl was given, but OpenSSL wasn't found])]) + AC_MSG_NOTICE([disabling --with-ssl]) + with_ssl=no])]) + +AM_CONDITIONAL([WITH_SSL], [test "$with_ssl" = yes]) + +# # Checks for header files. # accheck_includes=' @@ -172,6 +200,12 @@ accheck_includes=' #if defined(HAVE_NETINET_IN_SYSTM_H) # include <netinet/in_systm.h> #endif +#if defined(HAVE_NETINET_IP_H) +# include <netinet/ip.h> +#endif +#if defined(HAVE_NETINET_TCP_H) +# include <netinet/tcp.h> +#endif #if defined(HAVE_NETDB_H) # include <netdb.h> #endif @@ -206,6 +240,7 @@ AC_HEADER_TIOCGWINSZ AC_CHECK_HEADERS([arpa/ftp.h arpa/inet.h arpa/nameser.h err.h \ fcntl.h libgen.h limits.h locale.h malloc.h \ netinet/in.h netinet/in_systm.h netinet/ip.h \ + netinet/tcp.h \ paths.h poll.h pwd.h sys/poll.h regex.h \ setjmp.h signal.h stddef.h termcap.h termios.h \ unistd.h utime.h vis.h], @@ -401,4 +436,5 @@ AC_MSG_NOTICE([Prefix: $p AC_MSG_NOTICE([Command-line editing: $opt_editcomplete]) AC_MSG_NOTICE([IPv6 support: $opt_ipv6]) AC_MSG_NOTICE([SOCKS5 proxy support: $with_socks]) +AC_MSG_NOTICE([SSL: $with_ssl]) AC_MSG_NOTICE([ =============================]) Index: othersrc/usr.bin/tnftp/tnftp.h diff -u othersrc/usr.bin/tnftp/tnftp.h:1.34 othersrc/usr.bin/tnftp/tnftp.h:1.35 --- othersrc/usr.bin/tnftp/tnftp.h:1.34 Sun May 5 11:34:21 2013 +++ othersrc/usr.bin/tnftp/tnftp.h Sun May 5 13:17:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: tnftp.h,v 1.34 2013/05/05 11:34:21 lukem Exp $ */ +/* $NetBSD: tnftp.h,v 1.35 2013/05/05 13:17:05 lukem Exp $ */ #define FTP_PRODUCT PACKAGE_NAME #define FTP_VERSION PACKAGE_VERSION @@ -41,6 +41,9 @@ #if defined(HAVE_NETINET_IP_H) # include <netinet/ip.h> #endif +#if defined(HAVE_NETINET_TCP_H) +# include <netinet/tcp.h> +#endif #if defined(HAVE_NETDB_H) # if HAVE_DECL_AI_NUMERICHOST # include <netdb.h> @@ -504,3 +507,8 @@ int utimes(const char *, const struct ti */ #undef __dead #define __dead + +#ifdef __UNCONST +#undef __UNCONST +#endif +#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) Index: othersrc/usr.bin/tnftp/src/Makefile.am diff -u othersrc/usr.bin/tnftp/src/Makefile.am:1.2 othersrc/usr.bin/tnftp/src/Makefile.am:1.3 --- othersrc/usr.bin/tnftp/src/Makefile.am:1.2 Mon Jan 4 06:24:20 2010 +++ othersrc/usr.bin/tnftp/src/Makefile.am Sun May 5 13:17:06 2013 @@ -1,4 +1,4 @@ -## $NetBSD: Makefile.am,v 1.2 2010/01/04 06:24:20 lukem Exp $ +## $NetBSD: Makefile.am,v 1.3 2013/05/05 13:17:06 lukem Exp $ bin_PROGRAMS = tnftp @@ -35,6 +35,19 @@ tnftp_LDADD += \ endif +if WITH_SSL +tnftp_SOURCES += \ + ssl.c + +tnftp_CPPFLAGS += \ + $(OPENSSL_INCLUDES) + +tnftp_LDADD += \ + $(OPENSSL_LDFLAGS) \ + $(OPENSSL_LIBS) +endif + + man1_MANS = \ tnftp.1 Index: othersrc/usr.bin/tnftp/src/ssl.c diff -u othersrc/usr.bin/tnftp/src/ssl.c:1.1.1.1 othersrc/usr.bin/tnftp/src/ssl.c:1.2 --- othersrc/usr.bin/tnftp/src/ssl.c:1.1.1.1 Sun May 5 10:40:57 2013 +++ othersrc/usr.bin/tnftp/src/ssl.c Sun May 5 13:17:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ssl.c,v 1.1.1.1 2013/05/05 10:40:57 lukem Exp $ */ +/* $NetBSD: ssl.c,v 1.2 2013/05/05 13:17:06 lukem Exp $ */ /* from NetBSD: ssl.c,v 1.2 2012/12/24 22:12:28 christos Exp */ /*- @@ -32,6 +32,10 @@ * $FreeBSD: common.c,v 1.53 2007/12/19 00:26:36 des Exp $ */ +#include "tnftp.h" + +#if 0 /* tnftp */ + #include <sys/cdefs.h> #ifndef lint __RCSID(" NetBSD: ssl.c,v 1.2 2012/12/24 22:12:28 christos Exp "); @@ -47,6 +51,8 @@ __RCSID(" NetBSD: ssl.c,v 1.2 2012/12/24 #include <netinet/tcp.h> #include <netinet/in.h> +#endif /* tnftp */ + #include <openssl/crypto.h> #include <openssl/x509.h> #include <openssl/pem.h>