Commit ba582f75 authored by Wayne Davison's avatar Wayne Davison

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).
parent cbd85b47
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment