RE: How to deal with "salt" using authMSQL? » mod_auth_mysql.patch
| /root/mod_auth_mysql.c 2011-06-20 16:56:29.000000000 +0300 | ||
|---|---|---|
|
char *auth_table = "mysql_auth", *auth_user_field = "username",
|
||
|
*auth_password_field = "passwd", *auth_password_clause = "";
|
||
|
char *query;
|
||
|
char *salt_and_passwordhash;
|
||
|
char *esc_user = NULL;
|
||
|
MYSQL_RES *result;
|
||
|
MYSQL_ROW sql_row;
|
||
| ... | ... | |
|
, auth_table, esc_user,auth_password_clause);
|
||
|
query = (char *) PSTRCAT(r->pool, "SELECT ", auth_password_field,
|
||
|
" FROM ", auth_table, " WHERE ",
|
||
|
", salt FROM ", auth_table, " WHERE ",
|
||
|
auth_user_field, "='", esc_user, "'",
|
||
|
auth_password_clause, NULL);
|
||
|
if (!query) {
|
||
| ... | ... | |
|
"No row returned or NULL value: %s", mysql_error(sec->dbh));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
rv = check_password(password, sql_row[0], r, sec);
|
||
|
salt_and_passwordhash = (char *) PSTRCAT(r->pool, sql_row[1], sha1_hex_hash(password), NULL);
|
||
|
APACHELOG(APLOG_DEBUG, r, "salt: [%s]", salt_and_passwordhash);
|
||
|
rv = check_password(salt_and_passwordhash, sql_row[0], r, sec);
|
||
|
if (rv == 0)
|
||
|
{
|
||
|
APACHELOG(APLOG_INFO, r,
|
||
- « Previous
- 1
- 2
- Next »