You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.7 KiB

commit bc112b0e7feece62ce98708092306639a8a53cce
Author: Wayne Davison <wayned@samba.org>
Date: Mon Oct 30 09:11:16 2017 -0700
Use full MD4 len for archaic protocol auth.
diff --git a/authenticate.c b/authenticate.c
index a106b0f..519429d 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -22,7 +22,6 @@
#include "itypes.h"
extern int read_only;
-extern int protocol_version;
extern char *password_file;
/***************************************************************************
@@ -75,6 +74,8 @@ static void gen_challenge(const char *addr, char *challenge)
sum_init(-1, 0);
sum_update(input, sizeof input);
len = sum_end(digest);
+ if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
+ len = MD4_DIGEST_LEN;
base64_encode(digest, len, challenge, 0);
}
@@ -90,6 +91,8 @@ static void generate_hash(const char *in, const char *challenge, char *out)
sum_update(in, strlen(in));
sum_update(challenge, strlen(challenge));
len = sum_end(buf);
+ if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
+ len = MD4_DIGEST_LEN;
base64_encode(buf, len, out, 0);
}
@@ -238,11 +241,6 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
if (!users || !*users)
return "";
- if (protocol_version < 21) { /* Don't allow a weak checksum for the password. */
- rprintf(FERROR, "ERROR: protocol version is too old!\n");
- exit_cleanup(RERR_PROTOCOL);
- }
-
gen_challenge(addr, challenge);
io_printf(f_out, "%s%s\n", leader, challenge);
diff --git a/checksum.c b/checksum.c
index c119f97..741ad7d 100644
--- a/checksum.c
+++ b/checksum.c
@@ -86,6 +86,8 @@ int csum_len_for_type(int cst)
return MD4_DIGEST_LEN;
case CSUM_MD5:
return MD5_DIGEST_LEN;
+ default: /* paranoia to prevent missing case values */
+ exit_cleanup(RERR_UNSUPPORTED);
}
return 0;
}
@@ -181,6 +183,8 @@ void get_checksum2(char *buf, int32 len, char *sum)
mdfour_result(&m, (uchar *)sum);
break;
}
+ default: /* paranoia to prevent missing case values */
+ exit_cleanup(RERR_UNSUPPORTED);
}
}
@@ -275,6 +279,8 @@ void sum_init(int csum_type, int seed)
break;
case CSUM_NONE:
break;
+ default: /* paranoia to prevent missing case values */
+ exit_cleanup(RERR_UNSUPPORTED);
}
}
@@ -322,6 +328,8 @@ void sum_update(const char *p, int32 len)
break;
case CSUM_NONE:
break;
+ default: /* paranoia to prevent missing case values */
+ exit_cleanup(RERR_UNSUPPORTED);
}
}
@@ -349,6 +357,8 @@ int sum_end(char *sum)
case CSUM_NONE:
*sum = '\0';
break;
+ default: /* paranoia to prevent missing case values */
+ exit_cleanup(RERR_UNSUPPORTED);
}
return csum_len_for_type(cursum_type);