Updated patches to work with the current trunk.
[rsync/rsync-patches.git] / openssl-support.diff
index 8015bd6..daa419b 100644 (file)
@@ -35,8 +35,8 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
 diff --git a/Makefile.in b/Makefile.in
-index feacb90..3016643 100644
 --- a/Makefile.in
 +++ b/Makefile.in
 @@ -41,7 +41,7 @@ OBJS3=progress.o pipe.o
@@ -49,21 +49,20 @@ index feacb90..3016643 100644
  TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
  
 diff --git a/cleanup.c b/cleanup.c
-index 19ef072..506f575 100644
 --- a/cleanup.c
 +++ b/cleanup.c
-@@ -25,6 +25,9 @@
- extern int am_server;
+@@ -26,6 +26,9 @@ extern int am_server;
  extern int am_daemon;
+ extern int am_receiver;
  extern int io_error;
 +#ifdef HAVE_OPENSSL
 +extern int use_ssl;
 +#endif
  extern int keep_partial;
  extern int got_xfer_error;
- extern int output_needs_newline;
-@@ -127,6 +130,14 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
-                               code, file, line);
+ extern int protocol_version;
+@@ -137,6 +140,14 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
+                               who_am_i(), code, file, line);
                }
  
 +#ifdef HAVE_OPENSSL
@@ -78,7 +77,6 @@ index 19ef072..506f575 100644
  #include "case_N.h"
  
 diff --git a/clientserver.c b/clientserver.c
-index b6afe00..5467c72 100644
 --- a/clientserver.c
 +++ b/clientserver.c
 @@ -30,6 +30,9 @@ extern int am_sender;
@@ -91,7 +89,7 @@ index b6afe00..5467c72 100644
  extern int rsync_port;
  extern int protect_args;
  extern int ignore_errors;
-@@ -134,8 +137,18 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
+@@ -133,8 +136,18 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
  #endif
  
        ret = start_inband_exchange(fd, fd, user, remote_argc, remote_argv);
@@ -111,7 +109,7 @@ index b6afe00..5467c72 100644
  }
  
  static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int am_client)
-@@ -278,6 +291,32 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -277,6 +290,32 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
        if (DEBUG_GTE(CMD, 1))
                print_child_argv("sending daemon args:", sargs);
  
@@ -144,7 +142,7 @@ index b6afe00..5467c72 100644
        io_printf(f_out, "%.*s\n", modlen, modname);
  
        /* Old servers may just drop the connection here,
-@@ -303,6 +342,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -302,6 +341,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
                         * server to terminate the listing of modules.
                         * We don't want to go on and transfer
                         * anything; just exit. */
@@ -155,7 +153,7 @@ index b6afe00..5467c72 100644
                        exit(0);
                }
  
-@@ -310,6 +353,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -309,6 +352,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
                        rprintf(FERROR, "%s\n", line);
                        /* This is always fatal; the server will now
                         * close the socket. */
@@ -166,7 +164,7 @@ index b6afe00..5467c72 100644
                        return -1;
                }
  
-@@ -1022,6 +1069,9 @@ int start_daemon(int f_in, int f_out)
+@@ -1028,6 +1075,9 @@ int start_daemon(int f_in, int f_out)
        if (exchange_protocols(f_in, f_out, line, sizeof line, 0) < 0)
                return -1;
  
@@ -176,7 +174,7 @@ index b6afe00..5467c72 100644
        line[0] = 0;
        if (!read_line_old(f_in, line, sizeof line))
                return -1;
-@@ -1033,6 +1083,20 @@ int start_daemon(int f_in, int f_out)
+@@ -1039,6 +1089,20 @@ int start_daemon(int f_in, int f_out)
                return -1;
        }
  
@@ -198,10 +196,9 @@ index b6afe00..5467c72 100644
                /* it's some sort of command that I don't understand */
                io_printf(f_out, "@ERROR: Unknown command '%s'\n", line);
 diff --git a/configure.in b/configure.in
-index bc7d4a7..73ca6c5 100644
 --- a/configure.in
 +++ b/configure.in
-@@ -293,6 +293,21 @@ if test x"$enable_locale" != x"no"; then
+@@ -318,6 +318,21 @@ if test x"$enable_locale" != x"no"; then
        AC_DEFINE(CONFIG_LOCALE)
  fi
  
@@ -224,7 +221,6 @@ index bc7d4a7..73ca6c5 100644
  case $host_os in
        *cygwin* ) AC_MSG_RESULT(yes)
 diff --git a/options.c b/options.c
-index e7c6c61..634b89e 100644
 --- a/options.c
 +++ b/options.c
 @@ -191,6 +191,14 @@ int logfile_format_has_o_or_i = 0;
@@ -242,7 +238,7 @@ index e7c6c61..634b89e 100644
  #define MAX_BATCH_NAME_LEN 256        /* Must be less than MAXPATHLEN-13 */
  char *batch_name = NULL;
  
-@@ -566,6 +574,7 @@ static void print_rsync_version(enum logcode f)
+@@ -567,6 +575,7 @@ static void print_rsync_version(enum logcode f)
        char const *links = "no ";
        char const *iconv = "no ";
        char const *ipv6 = "no ";
@@ -250,8 +246,8 @@ index e7c6c61..634b89e 100644
        STRUCT_STAT *dumstat;
  
  #if SUBPROTOCOL_VERSION != 0
-@@ -599,6 +608,9 @@ static void print_rsync_version(enum logcode f)
- #if defined HAVE_LUTIMES && defined HAVE_UTIMES
+@@ -600,6 +609,9 @@ static void print_rsync_version(enum logcode f)
+ #ifdef CAN_SET_SYMLINK_TIMES
        symtimes = "";
  #endif
 +#ifdef HAVE_OPENSSL
@@ -260,7 +256,7 @@ index e7c6c61..634b89e 100644
  
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -612,8 +624,8 @@ static void print_rsync_version(enum logcode f)
+@@ -613,8 +625,8 @@ static void print_rsync_version(enum logcode f)
                (int)(sizeof (int64) * 8));
        rprintf(f, "    %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
                got_socketpair, hardlinks, links, ipv6, have_inplace);
@@ -271,7 +267,7 @@ index e7c6c61..634b89e 100644
  
  #ifdef MAINTAINER_MODE
        rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -784,6 +796,13 @@ void usage(enum logcode F)
+@@ -785,6 +797,13 @@ void usage(enum logcode F)
  #endif
    rprintf(F," -4, --ipv4                  prefer IPv4\n");
    rprintf(F," -6, --ipv6                  prefer IPv6\n");
@@ -286,15 +282,15 @@ index e7c6c61..634b89e 100644
    rprintf(F,"(-h) --help                  show this help (-h works with no other options)\n");
  
 @@ -798,7 +817,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
+       OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
-       OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
--      OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN,
-+      OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_USE_SSL,
+-      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
++      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_USE_SSL,
+       OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
- static struct poptOption long_options[] = {
-@@ -1012,6 +1031,13 @@ static struct poptOption long_options[] = {
+@@ -1013,6 +1032,13 @@ static struct poptOption long_options[] = {
    {"checksum-seed",    0,  POPT_ARG_INT,    &checksum_seed, 0, 0, 0 },
    {"server",           0,  POPT_ARG_NONE,   0, OPT_SERVER, 0, 0 },
    {"sender",           0,  POPT_ARG_NONE,   0, OPT_SENDER, 0, 0 },
@@ -308,7 +304,7 @@ index e7c6c61..634b89e 100644
    /* All the following options switch us into daemon-mode option-parsing. */
    {"config",           0,  POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
    {"daemon",           0,  POPT_ARG_NONE,   0, OPT_DAEMON, 0, 0 },
-@@ -1039,6 +1065,13 @@ static void daemon_usage(enum logcode F)
+@@ -1040,6 +1066,13 @@ static void daemon_usage(enum logcode F)
    rprintf(F," -v, --verbose               increase verbosity\n");
    rprintf(F," -4, --ipv4                  prefer IPv4\n");
    rprintf(F," -6, --ipv6                  prefer IPv6\n");
@@ -322,7 +318,7 @@ index e7c6c61..634b89e 100644
    rprintf(F,"     --help                  show this help screen\n");
  
    rprintf(F,"\n");
-@@ -1064,6 +1097,13 @@ static struct poptOption long_daemon_options[] = {
+@@ -1065,6 +1098,13 @@ static struct poptOption long_daemon_options[] = {
    {"protocol",         0,  POPT_ARG_INT,    &protocol_version, 0, 0, 0 },
    {"server",           0,  POPT_ARG_NONE,   &am_server, 0, 0, 0 },
    {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
@@ -336,7 +332,7 @@ index e7c6c61..634b89e 100644
    {"verbose",         'v', POPT_ARG_NONE,   0, 'v', 0, 0 },
    {"no-verbose",       0,  POPT_ARG_VAL,    &verbose, 0, 0, 0 },
    {"no-v",             0,  POPT_ARG_VAL,    &verbose, 0, 0, 0 },
-@@ -1358,6 +1398,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1360,6 +1400,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                                        verbose++;
                                        break;
  
@@ -349,7 +345,7 @@ index e7c6c61..634b89e 100644
                                default:
                                        rprintf(FERROR,
                                            "rsync: %s: %s (in daemon mode)\n",
-@@ -1384,6 +1430,17 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1386,6 +1432,17 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                                exit_cleanup(RERR_SYNTAX);
                        }
  
@@ -367,7 +363,7 @@ index e7c6c61..634b89e 100644
                        *argv_p = argv = poptGetArgs(pc);
                        *argc_p = argc = count_args(argv);
                        am_starting_up = 0;
-@@ -1742,6 +1799,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1764,6 +1821,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        return 0;
  #endif
  
@@ -380,7 +376,7 @@ index e7c6c61..634b89e 100644
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -2108,6 +2171,17 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2160,6 +2223,17 @@ int parse_arguments(int *argc_p, const char ***argv_p)
        if (delay_updates && !partial_dir)
                partial_dir = tmp_partialdir;
  
@@ -398,7 +394,7 @@ index e7c6c61..634b89e 100644
        if (inplace) {
  #ifdef HAVE_FTRUNCATE
                if (partial_dir) {
-@@ -2698,9 +2772,18 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
+@@ -2750,9 +2824,18 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
  {
        char *path;
  
@@ -421,7 +417,6 @@ index e7c6c61..634b89e 100644
                                *port_ptr = RSYNC_PORT;
                        return path;
 diff --git a/rsync.h b/rsync.h
-index be7cf8a..7b7cc88 100644
 --- a/rsync.h
 +++ b/rsync.h
 @@ -31,6 +31,7 @@
@@ -432,7 +427,7 @@ index be7cf8a..7b7cc88 100644
  
  #define SYMLINK_PREFIX "/rsyncd-munged/"  /* This MUST have a trailing slash! */
  #define SYMLINK_PREFIX_LEN ((int)sizeof SYMLINK_PREFIX - 1)
-@@ -569,6 +570,11 @@ typedef unsigned int size_t;
+@@ -581,6 +582,11 @@ typedef unsigned int size_t;
  # define SIZEOF_INT64 SIZEOF_OFF_T
  #endif
  
@@ -446,7 +441,6 @@ index be7cf8a..7b7cc88 100644
        int32 size, entries;
 diff --git a/ssl.c b/ssl.c
 new file mode 100644
-index 0000000..f0d4d9f
 --- /dev/null
 +++ b/ssl.c
 @@ -0,0 +1,369 @@