From beff175de130c3ff3ac736c8ed89d0346df568a9 Mon Sep 17 00:00:00 2001 From: piernov Date: Sat, 15 May 2021 16:48:43 +0200 Subject: [PATCH] Fix use login for User homedir in LDAP posixAccount objectclass (intended to be used with the uid/gid/homedir fields) requires a homedir. Always set a homedir in LDAP for the User class even if user does not have a firstname by using the login instead. Additionally on Linux the login is typically used for the home directory rather than the first name. It also avoids having accentuated or other special characters (commonly found in names) in the home directory path. --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6c0645e82b7..2d5a09659db 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2689,7 +2689,7 @@ class User extends CommonObject } } } - if (!empty($this->firstname) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->firstname"; + if (!empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login"; return $info; }