From f091bc75cc02dd229d832a981eb5f60e28e57503 Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 18 Sep 2014 09:50:24 +1000 Subject: [PATCH] ckdb - salt new user --- src/ckdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index c8bfd20d..7d8e87ab 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -2710,7 +2710,7 @@ static K_ITEM *find_userid(int64_t userid) return find_in_ktree(userid_root, &look, cmp_userid, ctx); } -// TODO: endian? +// TODO: endian? (to avoid being all zeros?) static void make_salt(USERS *users) { long int r1, r2, r3, r4; @@ -2976,13 +2976,14 @@ static K_ITEM *users_add(PGconn *conn, char *username, char *emailaddress, STRNCPY(row->username, username); row->status[0] = '\0'; STRNCPY(row->emailaddress, emailaddress); - STRNCPY(row->passwordhash, passwordhash); snprintf(tohash, sizeof(tohash), "%s&#%s", username, emailaddress); HASH_BER(tohash, strlen(tohash), 1, hash, tmp); __bin2hex(row->secondaryuserid, (void *)(&hash), sizeof(hash)); make_salt(row); + password_hash(row->username, passwordhash, row->salt, + row->passwordhash, sizeof(row->passwordhash)); HISTORYDATEINIT(row, cd, by, code, inet); HISTORYDATETRANSFER(trf_root, row);