allow 60sec discrepancy for email based 2fa; fix dbms version compare issue when removing user; adjust pure-ftpd mysql.conf file permissions

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-08-12 18:37:38 +02:00
parent 869b01204a
commit 5d2ce4ecfb
7 changed files with 8 additions and 7 deletions

View File

@@ -84,7 +84,8 @@ if ($action == '2fa_entercode') {
// verify code set to user's data_2fa field
$sel_stmt = Database::prepare("SELECT `data_2fa` FROM " . $table . " WHERE `" . $field . "` = :uid");
$userinfo_code = Database::pexecute_first($sel_stmt, ['uid' => $uid]);
$result = $tfa->verifyCode($userinfo_code['data_2fa'], $code);
// 60sec discrepancy (possible slow email delivery)
$result = $tfa->verifyCode($userinfo_code['data_2fa'], $code, 60);
} else {
$result = $tfa->verifyCode($_SESSION['secret_2fa'], $code, 3);
}

View File

@@ -187,7 +187,7 @@ class DbManagerMySQL
*/
public function deleteUser(string $username, string $host)
{
if (Database::getAttribute(PDO::ATTR_SERVER_VERSION) < '5.0.2') {
if (version_compare(Database::getAttribute(PDO::ATTR_SERVER_VERSION), '5.0.2', '<')) {
// Revoke privileges (only required for MySQL 4.1.2 - 5.0.1)
$stmt = Database::prepare("REVOKE ALL PRIVILEGES ON * . * FROM `" . $username . "`@`" . $host . "`");
Database::pexecute($stmt);

View File

@@ -3174,7 +3174,7 @@ no
</content>
</file>
<file name="/etc/pure-ftpd/db/mysql.conf" chown="root:0"
chmod="0644" backup="true">
chmod="0640" backup="true">
<content><![CDATA[
##############################################
# #

View File

@@ -4742,7 +4742,7 @@ no
</content>
</file>
<file name="/etc/pure-ftpd/db/mysql.conf" chown="root:0"
chmod="0644" backup="true">
chmod="0640" backup="true">
<content><![CDATA[
##############################################
# #

View File

@@ -3961,7 +3961,7 @@ no
</content>
</file>
<file name="/etc/pure-ftpd/db/mysql.conf" chown="root:0"
chmod="0644" backup="true">
chmod="0640" backup="true">
<content><![CDATA[
##############################################
# #

View File

@@ -3953,7 +3953,7 @@ no
</content>
</file>
<file name="/etc/pure-ftpd/db/mysql.conf" chown="root:0"
chmod="0644" backup="true">
chmod="0640" backup="true">
<content><![CDATA[
##############################################
# #

View File

@@ -2628,7 +2628,7 @@ no
</content>
</file>
<file name="/etc/pure-ftpd/db/mysql.conf" chown="root:0"
chmod="0644" backup="true">
chmod="0640" backup="true">
<content><![CDATA[
##############################################
# #