From: Egor Date: Mon, 27 May 2024 11:02:24 +0000 (+0300) Subject: passwd: remove sha512 hashing X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=a6157171487236edf8cff4ce5587cb8611e2c8ac;p=patchyircd.git passwd: remove sha512 hashing --- diff --git a/src/job.c b/src/job.c index 4fc10f4..e0e5103 100644 --- a/src/job.c +++ b/src/job.c @@ -145,18 +145,6 @@ static int job_password_check_job(struct client_data *cl, const char *data, size const char *salt = strchr(pw, '\0')+1; char *hash = password_crypt(pw, salt); int rv = !hash || strcmp(hash, salt) != 0; - // TODO: remove cipher migration - if (!rv && salt[1] == '6') { - const char *getdatafile(const char *fn); - FILE *f = fopen(getdatafile("newhash.txt"), "ab" FOPEN_CLOEXEC); - if (f) { - fprintf(f, "%s:", hash); - memset(hash, 0, strlen(hash)); - hash = password_hash(pw); - fprintf(f, "%s\n", hash ? hash : "*"); - fclose(f); - } - } if (hash) memset(hash, 0, strlen(hash)); return rv; diff --git a/src/passwd.c b/src/passwd.c index 31261b1..81354f2 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -3,7 +3,6 @@ #include #ifndef _WIN32 #include -#include #else #include #endif @@ -13,10 +12,6 @@ char *password_crypt(const char *key, const char *setting) static char output[128]; if (setting[0] == '$' && setting[1] == '2' && setting[3] == '$') return crypt_blowfish(key, setting, output); -#ifndef _WIN32 - else if (setting[0] == '$' && setting[1] == '6' && setting[2] == '$') - return crypt(key, setting); -#endif else return strcpy(output, "*"); } @@ -47,12 +42,7 @@ char *password_hash2(const char *pw, int algo, int strength) salt[ 8+4*5] = b64[ubytes[0+3*5]<<4 & 63]; salt[ 9+4*5] = 0; } else { - salt[0] = '$'; - salt[1] = '6'; - salt[2] = '$'; - for (int i = 0; i < 16; i++) - salt[3+i] = b64[ubytes[i]&63]; - salt[19] = '\0'; + salt[0] = '\0'; } memset(ubytes, 0, 16);