Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
No need to copy buffer
  • Loading branch information
hntrmrrs committed Nov 3, 2008
1 parent 866f10a commit 94103ffc96ae41b9b648cf868103da4f38a86c6d
Showing 1 changed file with 2 additions and 6 deletions.
@@ -148,21 +148,17 @@ process_hashpw(ETERM *pid, ETERM *data)
ETERM *pattern, *pwd, *slt;
char *password, *salt;
char *ret = NULL;
char hashed[200];
pattern = erl_format("{Pass, Salt}");
if (erl_match(pattern, data)) {
pwd = erl_var_content(pattern, "Pass");
password = erl_iolist_to_string(pwd);
slt = erl_var_content(pattern, "Salt");
salt = erl_iolist_to_string(slt);
if (NULL == (ret = bcrypt(password, salt)) ||
0 == strncmp(ret, ":", 1)) {
0 == strcmp(ret, ":")) {
retval = process_reply(pid, CMD_HASHPW, "Invalid salt");
} else {
int retlen = strlen(ret);
strncpy(hashed, ret, retlen);
hashed[retlen] = 0;
retval = process_reply(pid, CMD_HASHPW, hashed);
retval = process_reply(pid, CMD_HASHPW, ret);
}
erl_free_term(pwd);
erl_free_term(slt);

0 comments on commit 94103ff

Please sign in to comment.