summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-05-21 08:27:04 +0000
committerWayne Davison <wayned@samba.org>2004-05-21 08:27:04 +0000
commitba582f753a4c3eb2dd793904fb6a378ed8ffd90a (patch)
treeaeb10d3c67d6759c709e29c992104dafd3f3c88b
parentcbd85b472ec8c79449613e821c0952cd7e179deb (diff)
downloadrsync-ba582f753a4c3eb2dd793904fb6a378ed8ffd90a.tar.gz
Changed sum_init() to take a seed value as an arg instead of always
using checksum_init. This fixes an authentication problem in server mode (as pointed out by Craig Barratt).
-rw-r--r--authenticate.c4
-rw-r--r--checksum.c8
-rw-r--r--match.c3
-rw-r--r--receiver.c3
4 files changed, 10 insertions, 8 deletions
diff --git a/authenticate.c b/authenticate.c
index 56be490b..db196617 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -65,7 +65,7 @@ static void gen_challenge(char *addr, char *challenge)
SIVAL(input, 20, tv.tv_usec);
SIVAL(input, 24, getpid());
- sum_init();
+ sum_init(0);
sum_update(input, sizeof input);
sum_end(challenge);
}
@@ -199,7 +199,7 @@ static void generate_hash(char *in, char *challenge, char *out)
{
char buf[16];
- sum_init();
+ sum_init(0);
sum_update(in, strlen(in));
sum_update(challenge, strlen(challenge));
sum_end(buf);
diff --git a/checksum.c b/checksum.c
index 19bd6f15..ce30e724 100644
--- a/checksum.c
+++ b/checksum.c
@@ -135,13 +135,13 @@ static int sumresidue;
static char sumrbuf[CSUM_CHUNK];
static struct mdfour md;
-void sum_init(void)
+void sum_init(int seed)
{
char s[4];
mdfour_begin(&md);
- sumresidue=0;
- SIVAL(s,0,checksum_seed);
- sum_update(s,4);
+ sumresidue = 0;
+ SIVAL(s, 0, seed);
+ sum_update(s, 4);
}
/**
diff --git a/match.c b/match.c
index 6909fca3..1eecf3c3 100644
--- a/match.c
+++ b/match.c
@@ -22,6 +22,7 @@
extern int verbose;
extern int am_server;
extern int do_progress;
+extern int checksum_seed;
typedef unsigned short tag;
@@ -299,7 +300,7 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
matches = 0;
data_transfer = 0;
- sum_init();
+ sum_init(checksum_seed);
if (len > 0 && s->count>0) {
build_hash_table(s);
diff --git a/receiver.c b/receiver.c
index c7cde828..5d191482 100644
--- a/receiver.c
+++ b/receiver.c
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+extern int checksum_seed;
static void delete_one(char *fn, int is_dir)
{
@@ -206,7 +207,7 @@ static int receive_data(int f_in,struct map_struct *mapbuf,int fd,char *fname,
read_sum_head(f_in, &sum);
- sum_init();
+ sum_init(checksum_seed);
while ((i = recv_token(f_in, &data)) != 0) {
if (do_progress)