diff options
author | Wayne Davison <wayned@samba.org> | 2005-01-10 20:52:08 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2005-01-10 20:52:08 +0000 |
commit | d82773ffe927866fe0a32599fb4d22992bf1f1c6 (patch) | |
tree | 13a1c9ff3dc0ab1d28dff6687ce0ddea835a4097 /lib/mdfour.c | |
parent | ec626b3f0ed6d85673d45f8f2afeb5e4946039f5 (diff) | |
download | rsync-d82773ffe927866fe0a32599fb4d22992bf1f1c6.tar.gz rsync-d82773ffe927866fe0a32599fb4d22992bf1f1c6.tar.bz2 rsync-d82773ffe927866fe0a32599fb4d22992bf1f1c6.zip |
Fixed the file_checksum1() function that is compiled only when
TEST_MDFOUR is defined: it did not have the fix that the main
rsync code got back in protocol 27 to properly handle files
that are a multiple of 64-bytes long.
Diffstat (limited to 'lib/mdfour.c')
-rw-r--r-- | lib/mdfour.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mdfour.c b/lib/mdfour.c index 8e06bdbb..38123c67 100644 --- a/lib/mdfour.c +++ b/lib/mdfour.c @@ -206,9 +206,11 @@ void mdfour(unsigned char *out, unsigned char *in, int n) } #ifdef TEST_MDFOUR +int protocol_version = 28; + static void file_checksum1(char *fname) { - int fd, i; + int fd, i, was_multiple_of_64 = 1; struct mdfour md; unsigned char buf[64*1024], sum[16]; @@ -222,9 +224,13 @@ static void file_checksum1(char *fname) while (1) { int n = read(fd, buf, sizeof(buf)); - if (n <= 0) break; + if (n <= 0) + break; + was_multiple_of_64 = !(n % 64); mdfour_update(&md, buf, n); } + if (was_multiple_of_64 && protocol_version >= 27) + mdfour_update(&md, buf, 0); close(fd); |