|
|
@ -2710,7 +2710,7 @@ static K_ITEM *find_userid(int64_t userid) |
|
|
|
return find_in_ktree(userid_root, &look, cmp_userid, ctx); |
|
|
|
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) |
|
|
|
static void make_salt(USERS *users) |
|
|
|
{ |
|
|
|
{ |
|
|
|
long int r1, r2, r3, r4; |
|
|
|
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); |
|
|
|
STRNCPY(row->username, username); |
|
|
|
row->status[0] = '\0'; |
|
|
|
row->status[0] = '\0'; |
|
|
|
STRNCPY(row->emailaddress, emailaddress); |
|
|
|
STRNCPY(row->emailaddress, emailaddress); |
|
|
|
STRNCPY(row->passwordhash, passwordhash); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(tohash, sizeof(tohash), "%s&#%s", username, emailaddress); |
|
|
|
snprintf(tohash, sizeof(tohash), "%s&#%s", username, emailaddress); |
|
|
|
HASH_BER(tohash, strlen(tohash), 1, hash, tmp); |
|
|
|
HASH_BER(tohash, strlen(tohash), 1, hash, tmp); |
|
|
|
__bin2hex(row->secondaryuserid, (void *)(&hash), sizeof(hash)); |
|
|
|
__bin2hex(row->secondaryuserid, (void *)(&hash), sizeof(hash)); |
|
|
|
|
|
|
|
|
|
|
|
make_salt(row); |
|
|
|
make_salt(row); |
|
|
|
|
|
|
|
password_hash(row->username, passwordhash, row->salt, |
|
|
|
|
|
|
|
row->passwordhash, sizeof(row->passwordhash)); |
|
|
|
|
|
|
|
|
|
|
|
HISTORYDATEINIT(row, cd, by, code, inet); |
|
|
|
HISTORYDATEINIT(row, cd, by, code, inet); |
|
|
|
HISTORYDATETRANSFER(trf_root, row); |
|
|
|
HISTORYDATETRANSFER(trf_root, row); |
|
|
|