Skip to content

Commit cd50a4c

Browse files
author
Marius Burkard
committed
- don't change admin count in security check on failed query
Fixes ispconfig/ispconfig3#3645
1 parent c795dfd commit cd50a4c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

security/check.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@
5353
$data_file = $data_dir.'/admincount';
5454
//get number of admins
5555
$tmp = $app->db->queryOneRecord("SELECT count(userid) AS number FROM sys_user WHERE typ = 'admin'");
56-
$admin_user_count_new = intval($tmp['number']);
57-
58-
if(is_file($data_file)) {
59-
$admin_user_count_old = intval(file_get_contents($data_file));
60-
if($admin_user_count_new != $admin_user_count_old) {
61-
$alert .= "The number of ISPConfig administrator users has changed. Old: $admin_user_count_old New: $admin_user_count_new \n";
56+
if($tmp) {
57+
$admin_user_count_new = intval($tmp['number']);
58+
59+
if(is_file($data_file)) {
60+
$admin_user_count_old = intval(file_get_contents($data_file));
61+
if($admin_user_count_new != $admin_user_count_old) {
62+
$alert .= "The number of ISPConfig administrator users has changed. Old: $admin_user_count_old New: $admin_user_count_new \n";
63+
file_put_contents($data_file,$admin_user_count_new);
64+
}
65+
} else {
66+
// first run, so we save the current count
6267
file_put_contents($data_file,$admin_user_count_new);
68+
chmod($data_file,0700);
6369
}
64-
} else {
65-
// first run, so we save the current count
66-
file_put_contents($data_file,$admin_user_count_new);
67-
chmod($data_file,0700);
6870
}
6971
}
7072

0 commit comments

Comments
 (0)