From def2ace914feba4902630cac2f61bde22be6feea Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 1 Mar 2005 01:38:43 +0000 Subject: [PATCH 1/1] Fixed failing hunks. --- backup-dir-dels.diff | 28 ++++---- chmod-option.diff | 14 ++-- link-by-hash.diff | 12 ++-- openssl-support.diff | 160 ++++++++++--------------------------------- source-cd.diff | 16 ++--- 5 files changed, 74 insertions(+), 156 deletions(-) diff --git a/backup-dir-dels.diff b/backup-dir-dels.diff index 55194ab..edc65dc 100644 --- a/backup-dir-dels.diff +++ b/backup-dir-dels.diff @@ -156,8 +156,8 @@ Marc St-Onge else ok = do_rmdir(fname) == 0; if (ok) { ---- orig/options.c 2005-02-25 18:44:31 -+++ options.c 2005-02-21 11:02:45 +--- orig/options.c 2005-03-01 01:22:59 ++++ options.c 2005-03-01 01:25:39 @@ -127,10 +127,14 @@ int no_detach int write_batch = 0; int read_batch = 0; @@ -214,23 +214,25 @@ Marc St-Onge backup_dir = sanitize_path(NULL, backup_dir, NULL, 0); + if (backup_dir_dels) + backup_dir_dels = sanitize_path(NULL, backup_dir_dels, NULL, 0); - if (files_from) - files_from = sanitize_path(NULL, files_from, NULL, 0); } -@@ -1036,6 +1048,12 @@ int parse_arguments(int *argc, const cha - if (check_filter(elp, backup_dir, 1) < 0) - goto options_rejected; + if (server_filter_list.head && !am_sender) { + struct filter_list_struct *elp = &server_filter_list; +@@ -1038,6 +1050,14 @@ int parse_arguments(int *argc, const cha + return 0; + } } + /* Clean backup_dir_dels same as for backup_dir */ + if (backup_dir_dels) { ++ if (!*backup_dir_dels) ++ goto options_rejected; + clean_fname(backup_dir_dels, 1); + if (check_filter(elp, backup_dir_dels, 1) < 0) + goto options_rejected; + } } - if (server_filter_list.head && files_from) { - if (!*files_from) -@@ -1058,6 +1076,16 @@ int parse_arguments(int *argc, const cha + + if (!backup_suffix) +@@ -1049,6 +1069,16 @@ int parse_arguments(int *argc, const cha backup_suffix); return 0; } @@ -247,7 +249,7 @@ Marc St-Onge if (backup_dir) { backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf); backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len; -@@ -1079,6 +1107,31 @@ int parse_arguments(int *argc, const cha +@@ -1070,6 +1100,31 @@ int parse_arguments(int *argc, const cha "--suffix cannot be a null string without --backup-dir\n"); return 0; } @@ -279,7 +281,7 @@ Marc St-Onge if (make_backups && !backup_dir) omit_dir_times = 1; -@@ -1346,6 +1399,10 @@ void server_options(char **args,int *arg +@@ -1348,6 +1403,10 @@ void server_options(char **args,int *arg args[ac++] = "--backup-dir"; args[ac++] = backup_dir; } @@ -290,7 +292,7 @@ Marc St-Onge /* Only send --suffix if it specifies a non-default value. */ if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) { -@@ -1354,7 +1411,13 @@ void server_options(char **args,int *arg +@@ -1356,7 +1415,13 @@ void server_options(char **args,int *arg goto oom; args[ac++] = arg; } diff --git a/chmod-option.diff b/chmod-option.diff index 4f8d05c..4b57fd2 100644 --- a/chmod-option.diff +++ b/chmod-option.diff @@ -225,8 +225,8 @@ command before "make": file->uid = st.st_uid; file->gid = st.st_gid; ---- orig/options.c 2005-02-25 18:44:31 -+++ options.c 2005-02-16 15:38:40 +--- orig/options.c 2005-03-01 01:22:59 ++++ options.c 2005-03-01 01:26:56 @@ -140,6 +140,7 @@ char *log_format = NULL; char *password_file = NULL; char *rsync_path = RSYNC_PATH; @@ -260,7 +260,7 @@ command before "make": {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 }, -@@ -1082,6 +1087,13 @@ int parse_arguments(int *argc, const cha +@@ -1073,6 +1078,13 @@ int parse_arguments(int *argc, const cha if (make_backups && !backup_dir) omit_dir_times = 1; @@ -274,7 +274,7 @@ command before "make": if (log_format) { if (strstr(log_format, "%i") != NULL) log_format_has_i = 1; -@@ -1433,6 +1445,11 @@ void server_options(char **args,int *arg +@@ -1435,6 +1447,11 @@ void server_options(char **args,int *arg } } @@ -283,10 +283,10 @@ command before "make": + args[ac++] = chmod_mode; + } + - if (files_from && (!am_sender || remote_filesfrom_file)) { - if (remote_filesfrom_file) { + if (files_from && (!am_sender || filesfrom_host)) { + if (filesfrom_host) { args[ac++] = "--files-from"; ---- orig/rsync.yo 2005-02-28 02:16:55 +--- orig/rsync.yo 2005-03-01 01:22:59 +++ rsync.yo 2005-01-24 01:48:43 @@ -322,6 +322,7 @@ to the detailed description below for a -D, --devices preserve devices (root only) diff --git a/link-by-hash.diff b/link-by-hash.diff index 36173ef..edc1497 100644 --- a/link-by-hash.diff +++ b/link-by-hash.diff @@ -365,8 +365,8 @@ the file's name. +} + +#endif ---- orig/options.c 2005-02-25 18:44:31 -+++ options.c 2005-02-14 02:52:09 +--- orig/options.c 2005-03-01 01:22:59 ++++ options.c 2005-03-01 01:27:55 @@ -140,6 +140,7 @@ char *log_format = NULL; char *password_file = NULL; char *rsync_path = RSYNC_PATH; @@ -422,7 +422,7 @@ the file's name. default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -1433,6 +1451,11 @@ void server_options(char **args,int *arg +@@ -1435,6 +1453,11 @@ void server_options(char **args,int *arg } } @@ -431,8 +431,8 @@ the file's name. + args[ac++] = link_by_hash_dir; + } + - if (files_from && (!am_sender || remote_filesfrom_file)) { - if (remote_filesfrom_file) { + if (files_from && (!am_sender || filesfrom_host)) { + if (filesfrom_host) { args[ac++] = "--files-from"; --- orig/receiver.c 2005-02-26 19:27:54 +++ receiver.c 2005-01-15 21:29:13 @@ -560,7 +560,7 @@ the file's name. #include "byteorder.h" #include "lib/mdfour.h" ---- orig/rsync.yo 2005-02-28 02:16:55 +--- orig/rsync.yo 2005-03-01 01:22:59 +++ rsync.yo 2005-02-13 06:58:47 @@ -355,6 +355,7 @@ to the detailed description below for a -y, --fuzzy find similar file for basis if no dest file diff --git a/openssl-support.diff b/openssl-support.diff index 2543996..dc66782 100644 --- a/openssl-support.diff +++ b/openssl-support.diff @@ -72,7 +72,7 @@ can't say if I've left any cleanup/compatibility errors in the code. if (verbose > 3) { rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n", code, safe_fname(file), line); ---- orig/clientserver.c 2005-02-27 07:33:41 +--- orig/clientserver.c 2005-03-01 01:22:59 +++ clientserver.c 2004-10-08 20:44:59 @@ -45,6 +45,9 @@ extern int select_timeout; extern int orig_umask; @@ -160,7 +160,7 @@ can't say if I've left any cleanup/compatibility errors in the code. return RERR_STARTCLIENT; } else { rprintf(FINFO,"%s\n", line); -@@ -536,6 +584,7 @@ static void send_listing(int fd) +@@ -552,6 +600,7 @@ static void send_listing(int fd) io_printf(fd,"@RSYNCD: EXIT\n"); } @@ -168,7 +168,7 @@ can't say if I've left any cleanup/compatibility errors in the code. /* this is called when a connection is established to a client and we want to start talking. The setup of the system is done from here */ -@@ -585,6 +634,9 @@ int start_daemon(int f_in, int f_out) +@@ -601,6 +650,9 @@ int start_daemon(int f_in, int f_out) if (protocol_version > remote_protocol) protocol_version = remote_protocol; @@ -178,7 +178,7 @@ can't say if I've left any cleanup/compatibility errors in the code. line[0] = 0; if (!read_line(f_in, line, sizeof line - 1)) return -1; -@@ -594,6 +646,20 @@ int start_daemon(int f_in, int f_out) +@@ -610,6 +662,20 @@ int start_daemon(int f_in, int f_out) return -1; } @@ -223,123 +223,8 @@ can't say if I've left any cleanup/compatibility errors in the code. AC_MSG_CHECKING([whether to call shutdown on all sockets]) case $host_os in *cygwin* ) AC_MSG_RESULT(yes) ---- orig/main.c 2005-02-28 02:16:55 -+++ main.c 2004-10-08 20:15:28 -@@ -56,6 +56,9 @@ extern int write_batch; - extern int batch_fd; - extern int batch_gen_fd; - extern int filesfrom_fd; -+#if HAVE_OPENSSL -+extern int use_ssl; -+#endif - extern pid_t cleanup_child_pid; - extern struct stats stats; - extern char *files_from; -@@ -866,33 +869,48 @@ static int start_client(int argc, char * - if ((rc = copy_argv(argv))) - return rc; - -- /* rsync:// always uses rsync server over direct socket connection */ -- if (strncasecmp(URL_PREFIX, argv[0], strlen(URL_PREFIX)) == 0 -- && !read_batch) { -- char *host, *path; -+ if (!read_batch) { /* for read_batch, NO source is specified */ -+ int url_prefix_len = sizeof URL_PREFIX - 1; - -- host = argv[0] + strlen(URL_PREFIX); -- p = strchr(host,'/'); -- if (p) { -- *p = '\0'; -- path = p+1; -- } else -- path = ""; -- if (*host == '[' && (p = strchr(host, ']')) != NULL) { -- host++; -- *p++ = '\0'; -- if (*p != ':') -- p = NULL; -- } else -- p = strchr(host, ':'); -- if (p) { -- rsync_port = atoi(p+1); -- *p = '\0'; -+ /* rsync:// always uses rsync server over direct socket connection */ -+ if (strncasecmp(URL_PREFIX, argv[0], url_prefix_len) != 0) { -+#if HAVE_OPENSSL -+ url_prefix_len = sizeof SSL_URL_PREFIX - 1; -+ if (strncasecmp(SSL_URL_PREFIX, argv[0], url_prefix_len) != 0) -+ url_prefix_len = 0; -+ else { -+ if (!use_ssl) -+ init_tls(); -+ use_ssl = 1; -+ } -+#else -+ url_prefix_len = 0; -+#endif -+ } -+ if (url_prefix_len) { -+ char *host, *path; -+ -+ host = argv[0] + url_prefix_len; -+ p = strchr(host,'/'); -+ if (p) { -+ *p = '\0'; -+ path = p+1; -+ } else -+ path = ""; -+ if (*host == '[' && (p = strchr(host, ']')) != NULL) { -+ host++; -+ *p++ = '\0'; -+ if (*p != ':') -+ p = NULL; -+ } else -+ p = strchr(host, ':'); -+ if (p) { -+ rsync_port = atoi(p+1); -+ *p = '\0'; -+ } -+ return start_socket_client(host, path, argc-1, argv+1); - } -- return start_socket_client(host, path, argc-1, argv+1); -- } - -- if (!read_batch) { /* for read_batch, NO source is specified */ - p = find_colon(argv[0]); - if (p) { /* source is remote */ - if (remote_filesfrom_file -@@ -924,12 +942,26 @@ static int start_client(int argc, char * - argv++; - } else { /* source is local */ - am_sender = 1; -- -+ url_prefix_len = sizeof URL_PREFIX - 1; - /* rsync:// destination uses rsync server over direct socket */ -- if (strncasecmp(URL_PREFIX, argv[argc-1], strlen(URL_PREFIX)) == 0) { -+ if (strncasecmp(URL_PREFIX, argv[argc-1], url_prefix_len) != 0) { -+#if HAVE_OPENSSL -+ url_prefix_len = sizeof SSL_URL_PREFIX - 1; -+ if (strncasecmp(SSL_URL_PREFIX, argv[argc-1], url_prefix_len) != 0) -+ url_prefix_len = 0; -+ else { -+ if (!use_ssl) -+ init_tls(); -+ use_ssl = 1; -+ } -+#else -+ url_prefix_len = 0; -+#endif -+ } -+ if (url_prefix_len) { - char *host, *path; - -- host = argv[argc-1] + strlen(URL_PREFIX); -+ host = argv[argc-1] + url_prefix_len; - p = strchr(host,'/'); - if (p) { - *p = '\0'; ---- orig/options.c 2005-02-25 18:44:31 -+++ options.c 2004-11-27 18:31:46 +--- orig/options.c 2005-03-01 01:22:59 ++++ options.c 2005-03-01 01:34:42 @@ -155,6 +155,14 @@ int log_format_has_o_or_i = 0; int always_checksum = 0; int list_only = 0; @@ -437,7 +322,7 @@ can't say if I've left any cleanup/compatibility errors in the code. default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -1117,6 +1150,17 @@ int parse_arguments(int *argc, const cha +@@ -1108,6 +1141,17 @@ int parse_arguments(int *argc, const cha if (delay_updates && !partial_dir) partial_dir = partialdir_for_delayupdate; @@ -455,6 +340,37 @@ can't say if I've left any cleanup/compatibility errors in the code. if (inplace) { #ifdef HAVE_FTRUNCATE if (partial_dir) { +@@ -1475,11 +1519,28 @@ char *check_for_hostspec(char *s, char * + { + char *p; + int not_host; ++ int url_prefix_len = sizeof URL_PREFIX - 1; + +- if (port_ptr && strncasecmp(URL_PREFIX, s, strlen(URL_PREFIX)) == 0) { ++ if (!port_ptr) ++ url_prefix_len = 0; ++ else if (strncasecmp(URL_PREFIX, s, url_prefix_len) != 0) { ++#if HAVE_OPENSSL ++ url_prefix_len = sizeof SSL_URL_PREFIX - 1; ++ if (strncasecmp(SSL_URL_PREFIX, s, url_prefix_len) != 0) ++ url_prefix_len = 0; ++ else { ++ if (!use_ssl) ++ init_tls(); ++ use_ssl = 1; ++ } ++#else ++ url_prefix_len = 0; ++#endif ++ } ++ if (url_prefix_len) { + char *path; + int hostlen; +- s += strlen(URL_PREFIX); ++ s += url_prefix_len; + if ((p = strchr(s, '/')) != NULL) { + hostlen = p - s; + path = p + 1; --- orig/rsync.h 2005-02-23 02:57:27 +++ rsync.h 2004-10-08 21:01:33 @@ -32,6 +32,7 @@ diff --git a/source-cd.diff b/source-cd.diff index 336949a..4972dba 100644 --- a/source-cd.diff +++ b/source-cd.diff @@ -36,9 +36,9 @@ For two systems where one uses /usr/local/bin and the other /local/bin. while (1) { char fname2[MAXPATHLEN]; ---- orig/options.c 2005-02-25 18:44:31 -+++ options.c 2005-02-22 18:06:58 -@@ -81,6 +81,7 @@ char *remote_filesfrom_file = NULL; +--- orig/options.c 2005-03-01 01:22:59 ++++ options.c 2005-03-01 01:37:22 +@@ -81,6 +81,7 @@ char *filesfrom_host = NULL; int eol_nulls = 0; int recurse = 0; int xfer_dirs = 0; @@ -74,10 +74,10 @@ For two systems where one uses /usr/local/bin and the other /local/bin. if (read_batch && files_from) { snprintf(err_buf, sizeof err_buf, "--read-batch cannot be used with --files-from\n"); -@@ -1006,6 +1014,14 @@ int parse_arguments(int *argc, const cha +@@ -1004,6 +1012,14 @@ int parse_arguments(int *argc, const cha + partial_dir = sanitize_path(NULL, partial_dir, NULL, 0); + if (backup_dir) backup_dir = sanitize_path(NULL, backup_dir, NULL, 0); - if (files_from) - files_from = sanitize_path(NULL, files_from, NULL, 0); + if (source_cd) + source_cd = sanitize_path(NULL, source_cd, NULL, 0); + } else if (source_cd && am_daemon) { @@ -89,7 +89,7 @@ For two systems where one uses /usr/local/bin and the other /local/bin. } if (server_filter_list.head && !am_sender) { struct filter_list_struct *elp = &server_filter_list; -@@ -1395,6 +1411,11 @@ void server_options(char **args,int *arg +@@ -1397,6 +1413,11 @@ void server_options(char **args,int *arg } else if (keep_partial) args[ac++] = "--partial"; @@ -101,7 +101,7 @@ For two systems where one uses /usr/local/bin and the other /local/bin. if (ignore_errors) args[ac++] = "--ignore-errors"; ---- orig/rsync.yo 2005-02-28 02:16:55 +--- orig/rsync.yo 2005-03-01 01:22:59 +++ rsync.yo 2005-02-22 18:20:24 @@ -304,6 +304,7 @@ to the detailed description below for a -R, --relative use relative path names -- 2.34.1