mod_auth_mysql.patch

Jevgen Gyrynovych, 2011-06-20 16:19

Download (1.17 KB)

View differences:

/root/mod_auth_mysql.c 2011-06-20 16:56:29.000000000 +0300
1539 1539
	char *auth_table = "mysql_auth", *auth_user_field = "username",
1540 1540
		*auth_password_field = "passwd", *auth_password_clause = "";
1541 1541
	char *query;
1542
    char *salt_and_passwordhash;
1542 1543
	char *esc_user = NULL;
1543 1544
	MYSQL_RES *result;
1544 1545
	MYSQL_ROW sql_row;
......
1578 1579
							, auth_table, esc_user,auth_password_clause);
1579 1580

  
1580 1581
	query = (char *) PSTRCAT(r->pool, "SELECT ", auth_password_field,
1581
					" FROM ", auth_table, " WHERE ",
1582
					", salt FROM ", auth_table, " WHERE ",
1582 1583
					auth_user_field, "='", esc_user, "'",
1583 1584
					auth_password_clause, NULL);
1584 1585
	if (!query) {
......
1617 1618
					"No row returned or NULL value: %s", mysql_error(sec->dbh));
1618 1619
				return -1;
1619 1620
			}
1620
			
1621
			rv = check_password(password, sql_row[0], r, sec);
1621

  
1622
			salt_and_passwordhash = (char *) PSTRCAT(r->pool, sql_row[1], sha1_hex_hash(password), NULL);
1623
            APACHELOG(APLOG_DEBUG, r, "salt: [%s]", salt_and_passwordhash);
1624
            rv = check_password(salt_and_passwordhash, sql_row[0], r, sec); 
1622 1625
			if (rv == 0)
1623 1626
			{
1624 1627
				APACHELOG(APLOG_INFO, r,