Fix default gid 65534 for User in LDAP

posixAccount objectclass (intended to be used with the uid/gid/homedir fields) requires a gid.
Always set a gid in LDAP for the User class even if the user does not belong to any group.
By default 65534 which corresponds to the nobody group on major distributions (incl. Debian).
This commit is contained in:
piernov 2021-05-15 16:44:46 +02:00
parent b5c88d5817
commit 014b34acc6
No known key found for this signature in database
GPG Key ID: 46A3C65C574D3CDA

View File

@ -2678,10 +2678,10 @@ class User extends CommonObject
}
if (!empty($conf->global->LDAP_FIELD_USERID))$info[$conf->global->LDAP_FIELD_USERID] = $this->id;
if (!empty($info[$conf->global->LDAP_FIELD_GROUPID])) {
if (!empty($conf->global->LDAP_FIELD_GROUPID)) {
$usergroup = new UserGroup($this->db);
$groupslist = $usergroup->listGroupsForUser($this->id);
$info[$conf->global->LDAP_FIELD_GROUPID] = '1';
$info[$conf->global->LDAP_FIELD_GROUPID] = '65534';
if (!empty($groupslist)) {
foreach ($groupslist as $groupforuser) {
$info[$conf->global->LDAP_FIELD_GROUPID] = $groupforuser->id; //Select first group in list