fixed problem with groups that have no Samba group mapping

This commit is contained in:
Roland Gruber 2004-02-16 16:13:06 +00:00
parent 58be95f546
commit 61ce7a0a0c
1 changed files with 11 additions and 3 deletions

View File

@ -1370,10 +1370,11 @@ function createuser($values, $uselamdaemon=true) {
// Generate SID // Generate SID
$attr['sambaSID'] = $values->smb_domain->SID . "-" . (2 * $values->general_uidNumber + $values->smb_domain->RIDbase); // sambaAccount_may $attr['sambaSID'] = $values->smb_domain->SID . "-" . (2 * $values->general_uidNumber + $values->smb_domain->RIDbase); // sambaAccount_may
//if ($values->smb_mapgroup!='') $attr['sambaPrimaryGroupSID'] = $values->smb_mapgroup; // sambaAccount_req
ldapreload('group'); ldapreload('group');
foreach ($_SESSION['groupDN'] as $groupname) { foreach ($_SESSION['groupDN'] as $groupname) {
if ($groupname['cn'] == $values->general_group) $attr['sambaPrimaryGroupSID'] = $groupname['sambaSID']; if ($groupname['cn'] == $values->general_group) {
if ($groupname['sambaSID']) $attr['sambaPrimaryGroupSID'] = $groupname['sambaSID'];
}
} }
if ($values->smb_pwdcanchange!='') $attr['sambaPwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may if ($values->smb_pwdcanchange!='') $attr['sambaPwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may
else $attr['sambaPwdCanChange'] = time(); // sambaAccount_may else $attr['sambaPwdCanChange'] = time(); // sambaAccount_may
@ -1520,7 +1521,14 @@ function modifyuser($values,$values_old,$uselamdaemon=true) { // Will modify the
// Change SID only if we don't use a well known SID // Change SID only if we don't use a well known SID
ldapreload('group'); ldapreload('group');
foreach ($_SESSION['groupDN'] as $groupname) { foreach ($_SESSION['groupDN'] as $groupname) {
if ($groupname['cn'] == $values->general_group) $attr['sambaPrimaryGroupSID'] = $groupname['sambaSID']; if ($groupname['cn'] == $values->general_group) {
if ($groupname['sambaSID']) $attr['sambaPrimaryGroupSID'] = $groupname['sambaSID'];
else {
// remove primaryGroupSID if new group has no SID
$attr['sambaPrimaryGroupSID'] = $values_old->smb_mapgroup;
$attr_rem['sambaPrimaryGroupSID'] = $values_old->smb_mapgroup;
}
}
} }
} }
else { else {