From b187114c50d59480c5ea0d386653cdf2f21be2ba Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 21 Feb 2019 10:31:05 +0100 Subject: [PATCH] output real names in libnss-extrausers passwd file, fixes #659 Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cron/System/Extrausers.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Froxlor/Cron/System/Extrausers.php b/lib/Froxlor/Cron/System/Extrausers.php index b97da958..e837c683 100644 --- a/lib/Froxlor/Cron/System/Extrausers.php +++ b/lib/Froxlor/Cron/System/Extrausers.php @@ -24,7 +24,7 @@ class Extrausers { // passwd $passwd = '/var/lib/extrausers/passwd'; - $sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid ASC"; + $sql = "SELECT customerid,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 @@ -61,6 +61,13 @@ class Extrausers while ($u = $data_sel_stmt->fetch(\PDO::FETCH_ASSOC)) { switch ($type) { case 'passwd': + // get user real name + $salutation_array = array( + 'firstname' => \Froxlor\Customer\Customer::getCustomerDetail($u['customerid'], 'firstname'), + 'name' => \Froxlor\Customer\Customer::getCustomerDetail($u['customerid'], 'name'), + 'company' => \Froxlor\Customer\Customer::getCustomerDetail($u['customerid'], 'company') + ); + $u['comment'] = \Froxlor\User::getCorrectUserSalutation($salutation_array); if ($u['login_enabled'] != 'Y') { $u['password'] = '*'; $u['shell'] = '/bin/false';