The branch, master has been updated
via ab29ee9c Negotation env lists can specify "client & server"
via d07c2992 A few more simple changes & fixes.
from b1a8b09c Some man page changes.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -
commit ab29ee9c44ef8d58bd2a2bf1cf0e911c71a92104
Author: Wayne Davison
Date: Fri Jun 26 16:51:30 2020 -0700
Negotation env lists can specify "client & server"
commit d07c2992d1b672ac8524e462fcb5f4bf223de768
Author: Wayne Davison
Date: Fri Jun 26 13:10:10 2020 -0700
A few more simple changes & fixes.
---
Summary of changes:
NEWS.md| 3 ++-
batch.c| 8 ---
compat.c | 76 ++
ifuncs.h | 2 +-
options.c | 2 +-
rsync.1.md | 21 -
rsync.h| 12 +-
util2.c| 4 ++--
8 files changed, 80 insertions(+), 48 deletions(-)
Changeset truncated at 500 lines:
diff --git a/NEWS.md b/NEWS.md
index 2d81eb66..d579b955 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -17,7 +17,8 @@ Protocol: 31 (unchanged)
### ENHANCEMENTS:
- Allow the server side to restrict checksum & compression choices via
- the same environment variables the client uses.
+ the same environment variables the client uses. Allow the env vars
+ to be divided into "client list & server list" by the "`&`" char.
- Simplify how the negotiation environment variables apply to older rsync
versions.
diff --git a/batch.c b/batch.c
index 805acc6f..582c8c16 100644
--- a/batch.c
+++ b/batch.c
@@ -269,14 +269,6 @@ void write_batch_shell_file(void)
err |= write_opt("--exclude-from", "-");
}
- /* We need to make sure that any protocol-based or negotiated choices
get accurately
-* reflected in the options we save AND that we avoid any need for
--read-batch to
-* do a string-based negotiation (since we don't write them into the
file). */
- if (do_compression)
- err |= write_opt("--compress-choice", compress_choice);
- if (strchr(checksum_choice, ',') || xfersum_type !=
parse_csum_name(NULL, -1))
- err |= write_opt("--checksum-choice", checksum_choice);
-
/* Elide the filename args from the option list, but scan for them in
reverse. */
for (i = raw_argc-1, j = cooked_argc-1; i > 0 && j >= 0; i--) {
if (strcmp(raw_argv[i], cooked_argv[j]) == 0) {
diff --git a/compat.c b/compat.c
index ba14a8c5..bf0b4e6d 100644
--- a/compat.c
+++ b/compat.c
@@ -20,6 +20,7 @@
*/
#include "rsync.h"
+#include "itypes.h"
extern int am_server;
extern int am_sender;
@@ -109,6 +110,9 @@ struct name_num_obj valid_compressions = {
#define CF_INPLACE_PARTIAL_DIR (1<<6)
#define CF_VARINT_FLIST_FLAGS (1<<7)
+#define ENV_CHECKSUM 0
+#define ENV_COMPRESS 1
+
static const char *client_info;
/* The server makes sure that if either side only supports a pre-release
@@ -262,10 +266,14 @@ static void init_nno_saw(struct name_num_obj *nno, int
val)
static int parse_nni_str(struct name_num_obj *nno, const char *from, char
*tobuf, int tobuf_len)
{
char *to = tobuf, *tok = NULL;
- int cnt = 0;
+ int saw_tok = 0, cnt = 0;
while (1) {
- if (*from == ' ' || !*from) {
+ int at_space = isSpace(from);
+ char ch = *from++;
+ if (ch == '&')
+ ch = '\0';
+ if (!ch || at_space) {
if (tok) {
struct name_num_item *nni =
get_nni_by_name(nno, tok, to - tok);
if (nni && !nno->saw[nni->num]) {
@@ -279,9 +287,10 @@ static int parse_nni_str(struct name_num_obj *nno, const
char *from, char *tobuf
}
} else
to = tok - (tok != tobuf);
+ saw_tok = 1;
tok = NULL;
}
- if (!*from++)
+ if (!ch)
break;
continue;
}
@@ -294,10 +303,13 @@ static int parse_nni_str(struct name_num_obj *nno, const
char *from, char *tobuf
to = tok - (tok != tobuf);
break;
}
- *to++ = *from++;
+ *to++ = ch;
}
*to = '\0';
+ if (saw_tok && to == tobuf)
+ return strlcpy(tobuf, "INVALID", MAX_NSTR_STRLEN);
+
return to - tobuf;
}
@@ -349,14 +361,36 @@ static void recv_negotiate_str(int f_in, struct
name_num_obj *nno, char *tmpbuf,
exit_cleanup(RERR_UNSUPPORTED);
}
+static const char *getenv_nstr(int etype)
+{
+ con