mirror of
https://github.com/3proxy/3proxy.git
synced 2026-05-13 13:30:12 +08:00
Fix crypt passwords
This commit is contained in:
parent
b1d21cbdca
commit
6286bfcd6e
@ -202,15 +202,13 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
||||
magic = (unsigned char *)"$3$";
|
||||
{
|
||||
blake2b_state S;
|
||||
unsigned char _b2tmp[64];
|
||||
if(blake2b_init(&S, 64) != 0 ||
|
||||
if(blake2b_init(&S, MD5_SIZE) != 0 ||
|
||||
blake2b_update(&S, pw, strlen((char *)pw) + 1) != 0 ||
|
||||
blake2b_update(&S, sp, sl) != 0 ||
|
||||
blake2b_final(&S, _b2tmp, 64) != 0) {
|
||||
blake2b_final(&S, final, MD5_SIZE) != 0) {
|
||||
*passwd = 0;
|
||||
return NULL;
|
||||
}
|
||||
memcpy(final, _b2tmp, MD5_SIZE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -244,9 +244,9 @@ int strongauth(struct clientparam * param){
|
||||
return 6;
|
||||
}
|
||||
case CR:
|
||||
if (mycrypt(param->password, (unsigned char *)pass, buf) &&
|
||||
if (mycrypt(param->password, (unsigned char *)pass + 1, buf) &&
|
||||
!strcmp(pass + 1, (char *)buf))
|
||||
return 0;
|
||||
return 0;
|
||||
else return 7;
|
||||
#ifdef WITH_SSL
|
||||
case NT:
|
||||
|
||||
@ -559,13 +559,11 @@ static int h_users(int argc, unsigned char **argv){
|
||||
if((unsigned)l >= pwl_table.recsize) {
|
||||
if(*pass != CL) continue;
|
||||
blake2b_state S;
|
||||
unsigned char _b2tmp[64];
|
||||
unsigned hashsz;
|
||||
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
|
||||
blake2b_init(&S, 64);
|
||||
blake2b_init(&S, hashsz);
|
||||
blake2b_update(&S, pw[1], l + 1);
|
||||
blake2b_final(&S, _b2tmp, 64);
|
||||
memcpy((uint8_t *)(pass + 1), _b2tmp, hashsz);
|
||||
blake2b_final(&S, pass+1, hashsz);
|
||||
} else {
|
||||
memcpy(pass + 1, pw[1], l);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user