Changed sum_init() to take a seed value as an arg instead of always
authorWayne Davison <wayned@samba.org>
Fri, 21 May 2004 08:27:04 +0000 (08:27 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 21 May 2004 08:27:04 +0000 (08:27 +0000)
using checksum_init.  This fixes an authentication problem in server
mode (as pointed out by Craig Barratt).

authenticate.c
checksum.c
match.c
receiver.c

index 56be490..db19661 100644 (file)
@@ -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);
index 19bd6f1..ce30e72 100644 (file)
@@ -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 6909fca..1eecf3c 100644 (file)
--- 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);
index c7cde82..5d19148 100644 (file)
@@ -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)