summaryrefslogtreecommitdiff
path: root/compat.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-06-30 04:29:46 +0000
committerAndrew Tridgell <tridge@samba.org>1996-06-30 04:29:46 +0000
commitaae43eb38f8c49c8ac675f8269b06d11a72bd10e (patch)
treed3970e5058d47dfa392aed5fc35ca7c3de7f3a2d /compat.c
parentdc5ddbccace1f4f37d57ce5d961117effc28a356 (diff)
downloadrsync-aae43eb38f8c49c8ac675f8269b06d11a72bd10e.tar.gz
added checksum seed
Diffstat (limited to 'compat.c')
-rw-r--r--compat.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/compat.c b/compat.c
index 04913c2e..293bbc6c 100644
--- a/compat.c
+++ b/compat.c
@@ -21,6 +21,8 @@
#include "rsync.h"
+extern int am_server;
+
extern int csum_length;
extern int preserve_links;
@@ -30,6 +32,7 @@ extern int preserve_uid;
extern int preserve_gid;
extern int preserve_times;
extern int always_checksum;
+extern int checksum_seed;
extern int remote_version;
@@ -180,8 +183,24 @@ void receive_file_entry_v10(struct file_struct *file,
-void setup_protocol(void)
+void setup_protocol(int f_out,int f_in)
{
+ if (am_server) {
+ remote_version = read_int(f_in);
+ write_int(f_out,PROTOCOL_VERSION);
+ write_flush(f_out);
+ } else {
+ write_int(f_out,PROTOCOL_VERSION);
+ write_flush(f_out);
+ remote_version = read_int(f_in);
+ }
+
+ if (remote_version < MIN_PROTOCOL_VERSION ||
+ remote_version > MAX_PROTOCOL_VERSION) {
+ fprintf(FERROR,"protocol version mismatch - is your shell clean?\n");
+ exit_cleanup(1);
+ }
+
if (remote_version == 10) {
send_file_entry = send_file_entry_v10;
receive_file_entry = receive_file_entry_v10;
@@ -189,5 +208,14 @@ void setup_protocol(void)
send_file_entry = send_file_entry_v11;
receive_file_entry = receive_file_entry_v11;
}
+
+ if (remote_version >= 12) {
+ if (am_server) {
+ checksum_seed = time(NULL);
+ write_int(f_out,checksum_seed);
+ } else {
+ checksum_seed = read_int(f_in);
+ }
+ }
}