X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=common%2Fauth.c;h=ef548ec8a312e23c9a7ec212c821b97dac29adc8;hb=abeaeafe6860bef22ab8469261d3198efc8358c1;hp=9053a2678245e0f92a6b69f319accbd172c856ae;hpb=b97aaf62ec7989362d563df202d5a62db68e3e0a;p=blerg.git diff --git a/common/auth.c b/common/auth.c index 9053a26..ef548ec 100644 --- a/common/auth.c +++ b/common/auth.c @@ -18,7 +18,7 @@ int auth_set_password(const char *username, const char *password) { char filename[FILENAME_MAX]; - unsigned char pwhash[SCRYPT_OUTPUT_SIZE]; + uint8_t pwhash[SCRYPT_OUTPUT_SIZE]; uint8_t salt[SCRYPT_SALT_SIZE]; int fd, n, r; @@ -184,13 +184,13 @@ int auth_check_password_v1(const char *username, const char *password) { unsigned char givenpw[SCRYPT_OUTPUT_SIZE]; int r; - if (auth_get_password(username, epw) == 0) + if (auth_get_password(username, (char *)epw) == 0) return 0; if (auth_get_salt(username, esalt) == 0) return 0; - r = crypto_scrypt(password, strlen(password), esalt, SCRYPT_SALT_SIZE, SCRYPT_N, SCRYPT_r, SCRYPT_p, givenpw, SCRYPT_OUTPUT_SIZE); + r = crypto_scrypt((const uint8_t *)password, strlen(password), esalt, SCRYPT_SALT_SIZE, SCRYPT_N, SCRYPT_r, SCRYPT_p, givenpw, SCRYPT_OUTPUT_SIZE); if (r != 0) { fprintf(stderr, "Failure in scrypt for %s\n", username); return 0; @@ -218,6 +218,8 @@ int auth_check_password(const char *username, const char *password) { case 1: return auth_check_password_v1(username, password); } + fprintf(stderr, "auth_check_password fell through. Bad password version?\n"); + return 0; } void hexify(char *dst, char *src, int len) { @@ -231,7 +233,7 @@ void hexify(char *dst, char *src, int len) { } char *create_random_token() { - unsigned char buf[TOKEN_SIZE]; + char buf[TOKEN_SIZE]; char *token; int rand_fd;