aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/auth
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/auth')
-rw-r--r--phpBB/includes/auth/auth_apache.php19
-rw-r--r--phpBB/includes/auth/auth_db.php6
2 files changed, 17 insertions, 8 deletions
diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php
index 80ac81ed46..930f5a0632 100644
--- a/phpBB/includes/auth/auth_apache.php
+++ b/phpBB/includes/auth/auth_apache.php
@@ -104,7 +104,7 @@ function login_apache(&$username, &$password)
'user_row' => $row,
);
}
-
+
// Successful login...
return array(
'status' => LOGIN_SUCCESS,
@@ -227,15 +227,22 @@ function user_row_apache($username, $password)
*/
function validate_session_apache(&$user)
{
- if (!isset($_SERVER['PHP_AUTH_USER']))
+ // Check if PHP_AUTH_USER is set and handle this case
+ if (isset($_SERVER['PHP_AUTH_USER']))
{
- return false;
+ $php_auth_user = '';
+ set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
+
+ return ($php_auth_user === $user['username']) ? true : false;
}
- $php_auth_user = '';
- set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
+ // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not)
+ if ($user['user_type'] == USER_IGNORE)
+ {
+ return true;
+ }
- return ($php_auth_user === $user['username']) ? true : false;
+ return false;
}
?> \ No newline at end of file
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index 1a5fd9e418..24d4c56614 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -141,7 +141,9 @@ function login_db(&$username, &$password)
}
// cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
- if (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])
+ // plain md5 support left in for conversions from other systems.
+ if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password'])))
+ || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])))
{
$hash = phpbb_hash($password_new_format);
@@ -155,7 +157,7 @@ function login_db(&$username, &$password)
$row['user_pass_convert'] = 0;
$row['user_password'] = $hash;
}
- else
+ else
{
// Although we weren't able to convert this password we have to
// increase login attempt count to make sure this cannot be exploited