version 1.15, 2015/11/05 20:07:15 |
version 1.16, 2017/06/07 09:11:52 |
|
|
int |
int |
main(int argc, char** argv) |
main(int argc, char** argv) |
{ |
{ |
char salt[_PASSWORD_LEN], tmpl[sizeof("/tmp/htpasswd-XXXXXXXXXX")]; |
char tmpl[sizeof("/tmp/htpasswd-XXXXXXXXXX")]; |
char hash[_PASSWORD_LEN], pass[1024], pass2[1024]; |
char hash[_PASSWORD_LEN], pass[1024], pass2[1024]; |
char *line = NULL, *login = NULL, *tok; |
char *line = NULL, *login = NULL, *tok; |
int c, fd, loginlen, batch = 0; |
int c, fd, loginlen, batch = 0; |
|
|
explicit_bzero(pass2, sizeof(pass2)); |
explicit_bzero(pass2, sizeof(pass2)); |
} |
} |
|
|
if (strlcpy(salt, bcrypt_gensalt(8), sizeof(salt)) >= sizeof(salt)) |
if (crypt_newhash(pass, "bcrypt,a", hash, sizeof(hash)) != 0) |
errx(1, "salt too long"); |
err(1, "can't generate hash"); |
if (strlcpy(hash, bcrypt(pass, salt), sizeof(hash)) >= sizeof(hash)) |
|
errx(1, "hash too long"); |
|
explicit_bzero(pass, sizeof(pass)); |
explicit_bzero(pass, sizeof(pass)); |
|
|
if (file == NULL) |
if (file == NULL) |