diff --git a/lam/help/help.inc b/lam/help/help.inc index 0b5b73d4..64c1a2d0 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -272,90 +272,12 @@ $helpArray = array ( "Text" => _("eMail Address")), "457" => array ("ext" => "FALSE", "Headline" => _("Save Profile"), "Text" => _("Save Profile")), - "458" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "459" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "460" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "461" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "462" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "463" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "464" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "465" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "466" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "467" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "468" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "469" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "470" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "471" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "472" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "473" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "474" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "475" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "476" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "477" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "478" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "479" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "480" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "481" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "482" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "483" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "484" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "485" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "486" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "487" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "488" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "489" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "490" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "491" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "492" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "493" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "494" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "495" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "496" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "497" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "498" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "499" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")) + "458" => array ("ext" => "FALSE", "Headline" => _("Host can change Password"), + "Text" => _("Host can change Password")), + "459" => array ("ext" => "FALSE", "Headline" => _("Host must change Password"), + "Text" => _("Host must change Password")), + "460" => array ("ext" => "FALSE", "Headline" => _("Windows Domain"), + "Text" => _("Windows Domain of host. Can be left empty.")) /* This is a sample help entry. Just copy this line an modify the vakues between the [] brackets. Help text is located in the array: "[Helpnumber]" => array ("ext" => "FALSE", "Headline" => _("[Headline]"), "Text" => _("[Text]"), "SeeAlso" => "[SeeAlso link]"), diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 67f0a5f7..5f558498 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -1031,7 +1031,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account // Value stored in shadowExpire, days since 1.1.1970 $date = mktime(10,0,0, $values->unix_pwdexpire_mon, $values->unix_pwdexpire_day, $values->unix_pwdexpire_yea) / 86400 ; settype($date, 'integer'); - $values->general_dn = 'uid=' . $values->general_username . ',' . $_SESSION['config']->get_UserSuffix(); + $values->general_dn = 'uid=' . $values->general_username . ',' . $_SESSION['config']->get_HostSuffix(); if ($values->general_username != $values_old->general_username) { $attr['cn'] = $values->general_username; // posixAccount_req shadowAccount_req sambaAccount_may $attr['uid'] = $values->general_username; // posixAccount_req @@ -1094,7 +1094,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account if ($values->smb_pwdcanchange==0 && $values_old->smb_pwdcanchange==1) $attr_rem['pwdCanChange'] = "1"; else $attr['pwdCanChange'] = "0"; // sambaAccount_may if ($values->smb_pwdmustchange && $values->smb_pwdmustchange==0) $attr['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may if ($values->smb_pwdmustchange==0 && $values->smb_pwdmustchange==1) $attr_rem['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may - $attr['acctFlags'] = smbflag(); // sambaAccount_may + $attr['acctFlags'] = smbflag($values); // sambaAccount_may if (($values->smb_domain!='') && ($values->smb_domain!=$values_old->smb_domain)) $attr['domain'] = $values->smb_domain; // sambaAccount_may if (($values->smb_domain=='') && ($values->smb_domain!=$values_old->smb_domain)) $attr_rem['domain'] = $values_old->smb_domain; // sambaAccount_may @@ -1102,18 +1102,18 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account $success = ldap_mod_del($_SESSION['ldap']->server(),$values->general_dn, $attr_rem); if (!$success) return 5; } - if ($values->general_username == $values_old->general_username) // Username hasn't changed + if ($values->general_username == $values_old->general_username) // Hostname hasn't changed $success = ldap_modify($_SESSION['ldap']->server(),$values->general_dn, $attr); - else { - $result = ldap_search($_SESSION['ldap']->server(), $dn, "objectclass=PosixAccount"); - $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); - $attr_old = ldap_get_attributes($_SESSION['ldap']->server(), $entry); - $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr_old); - if ($success) $success = ldap_delete($_SESSION['ldap']->server(),$values_old->general_dn); - if ($success) $success = ldap_mod_replace($_SESSION['ldap']->server(),$values->general_dn, $attr); - } + else { + $result = ldap_search($_SESSION['ldap']->server(), $dn, "objectclass=PosixAccount"); + $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); + $attr_old = ldap_get_attributes($_SESSION['ldap']->server(), $entry); + $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr_old); + if ($success) $success = ldap_delete($_SESSION['ldap']->server(),$values_old->general_dn); + if ($success) $success = ldap_mod_replace($_SESSION['ldap']->server(),$values->general_dn, $attr); + } if (!$success) return 5; - $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), 'objectClass=PosixGroup'); + $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), 'objectClass=PosixGroup', array('memberUid', 'cn')); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); while ($entry) { $modifygroup=0; @@ -1121,13 +1121,13 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account if ($attr2['memberUid']) { array_shift($attr2['memberUid']); foreach ($attr2['memberUid'] as $nam) { - if ( ($nam==$values->general_username) && !in_array($nam, $values->general_groupadd)) { + if ( ($nam==$values->general_username) && !in_array($attr2['cn'][0], $values->general_groupadd)) { $todelete['memberUid'] = $nam; $success = ldap_mod_del($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry) ,$todelete); if (!$success) return 5; } } - if (!in_array($values->general_username, $attr2['memberUid']) && in_array($attr2['cn'][0], $values->general_groupadd)) { + if (!in_array($values->general_username, $attr2['memberUid']) && in_array($attr2['cn'][0], $values->general_groupadd) && ($attr2['cn'][0]!=$values->general_group)) { $toadd['memberUid'] = $attr2['memberUid']; $toadd['memberUid'][] = $values->general_username; $success = ldap_mod_replace($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry), $toadd); @@ -1135,7 +1135,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account } } else { - if (in_array($attr2['cn'][0], $values->general_groupadd)) { + if (in_array($attr2['cn'][0], $values->general_groupadd) && ($attr2['cn'][0]!=$values->general_group)) { $toadd['memberUid'] = $values->general_username; $success = ldap_mod_add($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry), $toadd); if (!$success) return 5; diff --git a/lam/templates/account.php b/lam/templates/account.php index 6a8e10f1..c87fcad2 100644 --- a/lam/templates/account.php +++ b/lam/templates/account.php @@ -55,7 +55,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch else $_SESSION['account']->general_uidNumber = ""; if ($_POST['f_general_group']) $_SESSION['account']->general_group = $_POST['f_general_group']; if ($_POST['f_general_groupadd']) $_SESSION['account']->general_groupadd = $_POST['f_general_groupadd']; - else $_SESSION['account']->general_groupadd = ''; + else $_SESSION['account']->general_groupadd = array(''); if ($_POST['f_general_homedir']) $_SESSION['account']->general_homedir = $_POST['f_general_homedir']; else $_SESSION['account']->general_homedir = ""; if ($_POST['f_general_shell']) $_SESSION['account']->general_shell = $_POST['f_general_shell']; @@ -655,7 +655,9 @@ switch ($select_local) { // Select which part of page will be loaded echo _('Account deactivated'); echo ''."\n".'