From 29703623381265506d79aa71cecb71a77089e074 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 11 Jul 2008 09:34:28 -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 | 3 +++ options.c | 30 ++++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 5e92e72e..924e7885 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ Changes since 3.0.3: - Added the --remote-option=OPT (-M OPT) command-line option that is useful for things like sending a remote --log-file=FILE or --fake-super option. + - Rsync will not send an -e option to the server if the user specifies the + --protocol=29 option. This lets rsync3 use an overly-restrictive server. + DEVELOPER RELATED: - ... diff --git a/options.c b/options.c index a79c5537..d534cec1 100644 --- a/options.c +++ b/options.c @@ -1838,22 +1838,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'; if (x > (int)sizeof argstr) { /* Not possible... */ -- 2.34.1