diff options
author | Wayne Davison <wayned@samba.org> | 2004-05-21 08:27:04 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2004-05-21 08:27:04 +0000 |
commit | ba582f753a4c3eb2dd793904fb6a378ed8ffd90a (patch) | |
tree | aeb10d3c67d6759c709e29c992104dafd3f3c88b | |
parent | cbd85b472ec8c79449613e821c0952cd7e179deb (diff) | |
download | rsync-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.c | 4 | ||||
-rw-r--r-- | checksum.c | 8 | ||||
-rw-r--r-- | match.c | 3 | ||||
-rw-r--r-- | receiver.c | 3 |
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); @@ -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); } /** @@ -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); @@ -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) |