From 9e58ef45f3e1f073904725240e698d167420462a Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 23 Jul 2008 23:09:15 -0700 Subject: [PATCH] If the user specifies --protocol=29, rsync will avoid sending an -e option to the server (which is only useful for protocols 30 and above anyway). This gives the user an easy way to talk to a restricted server that has overly restrictive option-checking. --- NEWS | 8 +++++++- options.c | 31 ++++++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index df99b24e..da273e1d 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,12 @@ Changes since 3.0.3: - Changed the hard-link code to never try to allocate 0 bytes of memory. This fixes a failure on some Operating Systems, such as AIX. + - Fixed a potential alignment issue in the IRIX ACL code when allocating + the initial "struct acl" object. Also, cast mallocs to avoid warnings. + ENHANCEMENTS: - - NONE + - Rsync will avoid sending an -e option to the server if an older protocol + in requested (and thus the option would not be useful). This lets the + user specify the --protocol=29 option to access an overly-restrictive + server. diff --git a/options.c b/options.c index 0ad26f89..4bb2ab39 100644 --- a/options.c +++ b/options.c @@ -1808,22 +1808,28 @@ void server_options(char **args, int *argc_p) if (do_compression) argstr[x++] = 'z'; - /* We make use of the -e option to let the server know about any - * pre-release protocol version && some behavior flags. */ - argstr[x++] = 'e'; + set_allow_inc_recurse(); + + /* Checking the pre-negotiated value allows --protocol=29 override. */ + if (protocol_version >= 30) { + /* We make use of the -e option to let the server know about + * any pre-release protocol version && some behavior flags. */ + argstr[x++] = 'e'; #if SUBPROTOCOL_VERSION != 0 - if (protocol_version == PROTOCOL_VERSION) { - x += snprintf(argstr+x, sizeof argstr - x, - "%d.%d", PROTOCOL_VERSION, SUBPROTOCOL_VERSION); - } else + if (protocol_version == PROTOCOL_VERSION) { + x += snprintf(argstr+x, sizeof argstr - x, + "%d.%d", + PROTOCOL_VERSION, SUBPROTOCOL_VERSION); + } else #endif - argstr[x++] = '.'; - set_allow_inc_recurse(); - if (allow_inc_recurse) - argstr[x++] = 'i'; + argstr[x++] = '.'; + if (allow_inc_recurse) + argstr[x++] = 'i'; #if defined HAVE_LUTIMES && defined HAVE_UTIMES - argstr[x++] = 'L'; + argstr[x++] = 'L'; #endif + } + argstr[x] = '\0'; args[ac++] = argstr; @@ -2008,7 +2014,6 @@ void server_options(char **args, int *argc_p) * and it may be an older version that doesn't know this * option, so don't send it if client is the sender. */ - int i; for (i = 0; i < basis_dir_cnt; i++) { args[ac++] = dest_option; args[ac++] = basis_dir[i]; -- 2.34.1