From 57277eb1e34755bd7f13a7225f5e2d56ad4f6441 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Wed, 27 Dec 2017 10:36:10 +0100 Subject: [PATCH] also add locked users to the passwd file for quota not to rage :P thx J-BBB Signed-off-by: Michael Kaufmann (d00p) --- scripts/classes/class.Extrausers.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/classes/class.Extrausers.php b/scripts/classes/class.Extrausers.php index 17b312afe8..2ad38b7383 100644 --- a/scripts/classes/class.Extrausers.php +++ b/scripts/classes/class.Extrausers.php @@ -21,7 +21,7 @@ public static function generateFiles(&$cronlog) { // passwd $passwd = '/var/lib/extrausers/passwd'; - $sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell FROM ftp_users WHERE login_enabled = 'Y' ORDER BY uid ASC"; + $sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid ASC"; self::_generateFile($passwd, $sql, $cronlog); // group @@ -39,7 +39,6 @@ public static function generateFiles(&$cronlog) @chmod('/var/lib/extrausers/passwd', 0644); @chmod('/var/lib/extrausers/group', 0644); @chmod('/var/lib/extrausers/shadow', 0640); - } private static function _generateFile($file, $query, &$cronlog) @@ -59,6 +58,11 @@ private static function _generateFile($file, $query, &$cronlog) while ($u = $data_sel_stmt->fetch(PDO::FETCH_ASSOC)) { switch ($type) { case 'passwd': + if ($u['login_enabled'] != 'Y') { + $u['password'] = '*'; + $u['shell'] = '/bin/false'; + $u['comment'] = 'Locked Froxlor User'; + } $line = $u['username'] . ':' . $u['password'] . ':' . $u['uid'] . ':' . $u['gid'] . ':' . $u['comment'] . ':' . $u['homedir'] . ':' . $u['shell'] . PHP_EOL; break; case 'group':