]> PatchyGit - patchyircd.git/commitdiff
passwd: remove sha512 hashing
authorEgor <egor@patchysicp.xyz>
Mon, 27 May 2024 11:02:24 +0000 (14:02 +0300)
committerEgor <egor@patchysicp.xyz>
Mon, 27 May 2024 11:02:24 +0000 (14:02 +0300)
src/job.c
src/passwd.c

index 4fc10f4..e0e5103 100644 (file)
--- 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;
index 31261b1..81354f2 100644 (file)
@@ -3,7 +3,6 @@
 #include <string.h>
 #ifndef _WIN32
 #include <unistd.h>
-#include <crypt.h>
 #else
 #include <bcrypt.h>
 #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);