fixed problem with uid=0 or gid=0

This commit is contained in:
katagia 2003-07-14 12:27:52 +00:00
parent 9b6296920f
commit e87a3e722c
2 changed files with 109 additions and 109 deletions

View File

@ -286,8 +286,10 @@ function checkglobal($values, $type, $values_old=false) { // This functions chec
} }
// Check if UID is valid. If none value was entered, the next useable value will be inserted // Check if UID is valid. If none value was entered, the next useable value will be inserted
$return->general_uidNumber = checkid($values, $type, $values_old); $return->general_uidNumber = checkid($values, $type, $values_old);
if (is_string($return->general_uidNumber)) // true if checkid has returned an error if (is_string($return->general_uidNumber)) { // true if checkid has returned an error
$errors[] = array('ERROR', _('ID-Number'), $return->general_uidNumber); $errors[] = array('ERROR', _('ID-Number'), $return->general_uidNumber);
unset($return->general_uidNumber);
}
// Check if Name-length is OK. minLength=3, maxLength=20 // Check if Name-length is OK. minLength=3, maxLength=20
if ( !ereg('.{3,20}', $values->general_username)) $errors[] = array('ERROR', _('Name'), _('Name must content between 3 and 20 characters.')); if ( !ereg('.{3,20}', $values->general_username)) $errors[] = array('ERROR', _('Name'), _('Name must content between 3 and 20 characters.'));
// Check if Name starts with letter // Check if Name starts with letter
@ -580,7 +582,7 @@ function getgid($groupname) { // Will return the the gid to an existing Groupnam
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
while ($entry) { while ($entry) {
$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
if (($attr['gidNumber'][0]) && ($attr['cn'][0]==$groupname)) return $attr['gidNumber'][0]; if ((isset($attr['gidNumber'][0])) && ($attr['cn'][0]==$groupname)) return $attr['gidNumber'][0];
$entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry);
} }
return -1; return -1;
@ -672,14 +674,14 @@ function loaduser($dn) { // Will load all needed values from an existing account
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
$return->general_dn = ldap_get_dn($_SESSION['ldap']->server(), $entry); $return->general_dn = ldap_get_dn($_SESSION['ldap']->server(), $entry);
$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
if ($attr['uid'][0]) $return->general_username = $attr['uid'][0]; if (isset($attr['uid'][0])) $return->general_username = $attr['uid'][0];
if ($attr['uidNumber'][0]) $return->general_uidNumber = $attr['uidNumber'][0]; if (isset($attr['uidNumber'][0])) $return->general_uidNumber = $attr['uidNumber'][0];
if ($attr['homeDirectory'][0]) $return->general_homedir = $attr['homeDirectory'][0]; if (isset($attr['homeDirectory'][0])) $return->general_homedir = $attr['homeDirectory'][0];
if ($attr['shadowLastChange'][0]) $return->unix_shadowLastChange = $attr['shadowLastChange'][0]; if (isset($attr['shadowLastChange'][0])) $return->unix_shadowLastChange = $attr['shadowLastChange'][0];
if ($attr['loginShell'][0]) $return->general_shell = $attr['loginShell'][0]; if (isset($attr['loginShell'][0])) $return->general_shell = $attr['loginShell'][0];
if ($attr['gecos'][0]) $return->general_gecos = $attr['gecos'][0]; if (isset($attr['gecos'][0])) $return->general_gecos = $attr['gecos'][0];
if ($attr['description'][0]) $return->general_gecos = $attr['description'][0]; if (isset($attr['description'][0])) $return->general_gecos = $attr['description'][0];
if ($attr['gidNumber'][0]) { if (isset($attr['gidNumber'][0])) {
$result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn')); $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn'));
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
while ($entry) { while ($entry) {
@ -696,56 +698,57 @@ function loaduser($dn) { // Will load all needed values from an existing account
if (($id==$return->general_username) && ($attr2['cn'][0]!=$return->general_group)) $return->general_groupadd[]=$attr2['cn'][0]; if (($id==$return->general_username) && ($attr2['cn'][0]!=$return->general_group)) $return->general_groupadd[]=$attr2['cn'][0];
$entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry);
} }
if ($attr['shadowMin'][0]) $return->unix_pwdminage = $attr['shadowMin'][0]; if (isset($attr['shadowMin'][0])) $return->unix_pwdminage = $attr['shadowMin'][0];
if ($attr['shadowMax'][0]) $return->unix_pwdmaxage = $attr['shadowMax'][0]; if (isset($attr['shadowMax'][0])) $return->unix_pwdmaxage = $attr['shadowMax'][0];
if ($attr['shadowWarning'][0]) $return->unix_pwdwarn = $attr['shadowWarning'][0]; if (isset($attr['shadowWarning'][0])) $return->unix_pwdwarn = $attr['shadowWarning'][0];
if ($attr['shadowInactive'][0]) $return->unix_pwdallowlogin = $attr['shadowInactive'][0]; if (isset($attr['shadowInactive'][0])) $return->unix_pwdallowlogin = $attr['shadowInactive'][0];
if ($attr['shadowExpire'][0]) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400; if (isset($attr['shadowExpire'][0])) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400;
if ($_SESSION['config']->samba3 == 'yes') { if ($_SESSION['config']->samba3 == 'yes') {
if ($attr['sambaAcctFlags'][0]) { if (isset($attr['sambaAcctFlags'][0])) {
if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true; if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true;
if (strrpos($attr['sambaAcctFlags'][0], 'X')) $return->smb_flagsX=true; if (strrpos($attr['sambaAcctFlags'][0], 'X')) $return->smb_flagsX=true;
} }
if ($attr['sambaPwdCanChange'][0]) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0]; if (isset($attr['sambaPwdCanChange'][0])) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0];
if ($attr['sambaPwdMustChange'][0]) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][0]; if (isset($attr['sambaPwdMustChange'][0])) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][0];
if ($attr['sambaHomePath'][0]) $return->smb_smbhome = $attr['sambaHomePath'][0]; if (isset($attr['sambaHomePath'][0])) $return->smb_smbhome = $attr['sambaHomePath'][0];
if ($attr['sambaHomeDrive'][0]) $return->smb_homedrive = $attr['sambaHomeDrive'][0]; if (isset($attr['sambaHomeDrive'][0])) $return->smb_homedrive = $attr['sambaHomeDrive'][0];
if ($attr['sambaLogonScript'][0]) $return->smb_scriptPath = $attr['sambaLogonScript'][0]; if (isset($attr['sambaLogonScript'][0])) $return->smb_scriptPath = $attr['sambaLogonScript'][0];
if ($attr['sambaProfilePath'][0]) $return->smb_profilePath = $attr['sambaProfilePath'][0]; if (isset($attr['sambaProfilePath'][0])) $return->smb_profilePath = $attr['sambaProfilePath'][0];
if ($attr['sambaUserWorkstations'][0]) $return->smb_smbuserworkstations = $attr['sambaUserWorkstations'][0]; if (isset($attr['sambaUserWorkstations'][0])) $return->smb_smbuserworkstations = $attr['sambaUserWorkstations'][0];
if ($attr['sambaDomainName'][0]) $return->smb_domain = $attr['sambaDomainName'][0]; if (isset($attr['sambaDomainName'][0])) $return->smb_domain = $attr['sambaDomainName'][0];
if (isset($attr['sambaNTPassword'][0])) $return->smb_password = $attr['sambaNTPassword'][0];
} }
else { else {
if ($attr['acctFlags'][0]) { if (isset($attr['acctFlags'][0])) {
if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true; if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true;
if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true; if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true;
} }
if ($attr['smbHome'][0]) $return->smb_smbhome = $attr['smbHome'][0]; if (isset($attr['ntPassword'][0])) $return->smb_password = $attr['ntPassword'][0];
if ($attr['pwdCanChange'][0]) $return->smb_pwdcanchange = $attr['pwdCanChange'][0]; if (isset($attr['smbHome'][0])) $return->smb_smbhome = $attr['smbHome'][0];
if ($attr['pwdMustChange'][0]) $return->smb_pwdmustchange = $attr['pwdMustChange'][0]; if (isset($attr['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0];
if ($attr['homeDrive'][0]) $return->smb_homedrive = $attr['homeDrive'][0]; if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][0];
if ($attr['scriptPath'][0]) $return->smb_scriptPath = $attr['scriptPath'][0]; if (isset($attr['homeDrive'][0])) $return->smb_homedrive = $attr['homeDrive'][0];
if ($attr['profilePath'][0]) $return->smb_profilePath = $attr['profilePath'][0]; if (isset($attr['scriptPath'][0])) $return->smb_scriptPath = $attr['scriptPath'][0];
if ($attr['userWorkstations'][0]) $return->smb_smbuserworkstations = $attr['userWorkstations'][0]; if (isset($attr['profilePath'][0])) $return->smb_profilePath = $attr['profilePath'][0];
if ($attr['domain'][0]) $return->smb_domain = $attr['domain'][0]; if (isset($attr['userWorkstations'][0])) $return->smb_smbuserworkstations = $attr['userWorkstations'][0];
if (isset($attr['domain'][0])) $return->smb_domain = $attr['domain'][0];
} }
if ($attr['givenName'][0]) $return->general_givenname = $attr['givenName'][0]; if (isset($attr['givenName'][0])) $return->general_givenname = $attr['givenName'][0];
if ($attr['sn'][0]) $return->general_surname = $attr['sn'][0]; if (isset($attr['sn'][0])) $return->general_surname = $attr['sn'][0];
if ($attr['title'][0]) $return->personal_title = $attr['title'][0]; if (isset($attr['title'][0])) $return->personal_title = $attr['title'][0];
if ($attr['mail'][0]) $return->personal_mail = $attr['mail'][0]; if (isset($attr['mail'][0])) $return->personal_mail = $attr['mail'][0];
if ($attr['telephoneNumber'][0]) $return->personal_telephoneNumber = $attr['telephoneNumber'][0]; if (isset($attr['telephoneNumber'][0])) $return->personal_telephoneNumber = $attr['telephoneNumber'][0];
if ($attr['mobilemobileTelephoneNumber'][0]) $return->personal_mobileTelephoneNumber = $attr['mobilemobileTelephoneNumber'][0]; if (isset($attr['mobilemobileTelephoneNumber'][0])) $return->personal_mobileTelephoneNumber = $attr['mobilemobileTelephoneNumber'][0];
else if ($attr['mobile'][0]) $return->personal_mobileTelephoneNumber = $attr['mobile'][0]; else if (isset($attr['mobile'][0])) $return->personal_mobileTelephoneNumber = $attr['mobile'][0];
if ($attr['facsimileTelephoneNumber'][0]) $return->personal_facsimileTelephoneNumber = $attr['facsimileTelephoneNumber'][0]; if (isset($attr['facsimileTelephoneNumber'][0])) $return->personal_facsimileTelephoneNumber = $attr['facsimileTelephoneNumber'][0];
if ($attr['street'][0]) $return->personal_street = $attr['street'][0]; if (isset($attr['street'][0])) $return->personal_street = $attr['street'][0];
if ($attr['postalCode'][0]) $return->personal_postalCode = $attr['postalCode'][0]; if (isset($attr['postalCode'][0])) $return->personal_postalCode = $attr['postalCode'][0];
if ($attr['postalAddress'][0]) $return->personal_postalAddress = $attr['postalAddress'][0]; if (isset($attr['postalAddress'][0])) $return->personal_postalAddress = $attr['postalAddress'][0];
if ($attr['employeeType'][0]) $return->personal_employeeType = $attr['employeeType'][0]; if (isset($attr['employeeType'][0])) $return->personal_employeeType = $attr['employeeType'][0];
if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true; if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true;
if ($attr['userPassword'][0]) $return->unix_password = $attr['userPassword'][0]; if (isset($attr['userPassword'][0])) $return->unix_password = $attr['userPassword'][0];
if ($attr['ntPassword'][0]) $return->smb_password = $attr['ntPassword'][0];
if ($_SESSION['config']->scriptServer) { if ($_SESSION['config']->scriptServer) {
$values = getquotas('user',$return->general_username); $values = getquotas('user',$return->general_username);
if (is_object($values)) { if (is_object($values)) {
@ -762,12 +765,12 @@ function loadhost($dn) { // Will load all needed values from an existing account
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
$return->general_dn = (ldap_get_dn($_SESSION['ldap']->server(), $entry)); $return->general_dn = (ldap_get_dn($_SESSION['ldap']->server(), $entry));
$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
if ($attr['uid'][0]) $return->general_username = $attr['uid'][0]; if (isset($attr['uid'][0])) $return->general_username = $attr['uid'][0];
if ($attr['uidNumber'][0]) $return->general_uidNumber = $attr['uidNumber'][0]; if (isset($attr['uidNumber'][0])) $return->general_uidNumber = $attr['uidNumber'][0];
if ($attr['shadowLastChange'][0]) $return->unix_shadowLastChange = $attr['shadowLastChange'][0]; if (isset($attr['shadowLastChange'][0])) $return->unix_shadowLastChange = $attr['shadowLastChange'][0];
if ($attr['gecos'][0]) $return->general_gecos = $attr['gecos'][0]; if (isset($attr['gecos'][0])) $return->general_gecos = $attr['gecos'][0];
if ($attr['description'][0]) $return->general_gecos = $attr['description'][0]; if (isset($attr['description'][0])) $return->general_gecos = $attr['description'][0];
if ($attr['gidNumber'][0]) { if (isset($attr['gidNumber'][0])) {
$result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn')); $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), "objectclass=PosixGroup", array('gidNumber', 'cn'));
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
while ($entry) { while ($entry) {
@ -784,33 +787,33 @@ function loadhost($dn) { // Will load all needed values from an existing account
if (($id==$return->general_username) && ($attr2['cn'][0]!=$return->general_group)) $return->general_groupadd[]=$attr2['cn'][0]; if (($id==$return->general_username) && ($attr2['cn'][0]!=$return->general_group)) $return->general_groupadd[]=$attr2['cn'][0];
$entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry);
} }
if ($attr['shadowMin'][0]) $return->unix_pwdminage = $attr['shadowMin'][0]; if (isset($attr['shadowMin'][0])) $return->unix_pwdminage = $attr['shadowMin'][0];
if ($attr['shadowMax'][0]) $return->unix_pwdmaxage = $attr['shadowMax'][0]; if (isset($attr['shadowMax'][0])) $return->unix_pwdmaxage = $attr['shadowMax'][0];
if ($attr['shadowWarning'][0]) $return->unix_pwdwarn = $attr['shadowWarning'][0]; if (isset($attr['shadowWarning'][0])) $return->unix_pwdwarn = $attr['shadowWarning'][0];
if ($attr['shadowInactive'][0]) $return->unix_pwdallowlogin = $attr['shadowInactive'][0]; if (isset($attr['shadowInactive'][0])) $return->unix_pwdallowlogin = $attr['shadowInactive'][0];
if ($attr['shadowExpire'][0]) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400; if (isset($attr['shadowExpire'][0])) $return->unix_pwdexpire = $attr['shadowExpire'][0]*86400;
if ($_SESSION['config']->samba3 == 'yes') { if ($_SESSION['config']->samba3 == 'yes') {
if ($attr['sambaAcctFlags'][0]) { if (isset($attr['sambaAcctFlags'][0])) {
if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['sambaAcctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true; if (strrpos($attr['sambaAcctFlags'][0], 'D')) $return->smb_flagsD=true;
if (strrpos($attr['sambaAcctFlags'][0], 'X')) $return->smb_flagsX=true; if (strrpos($attr['sambaAcctFlags'][0], 'X')) $return->smb_flagsX=true;
} }
if ($attr['sambaPwdCanChange'][0]) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0]; if (isset($attr['sambaPwdCanChange'][0])) $return->smb_pwdcanchange = $attr['sambaPwdCanChange'][0];
if ($attr['sambaPwdMustChange'][0]) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][0]; if (isset($attr['sambaPwdMustChange'][0])) $return->smb_pwdmustchange = $attr['sambaPwdMustChange'][0];
if ($attr['sambaDomainName'][0]) $return->smb_domain = $attr['sambaDomainName'][0]; if (isset($attr['sambaDomainName'][0])) $return->smb_domain = $attr['sambaDomainName'][0];
} }
else { else {
if ($attr['acctFlags'][0]) { if (isset($attr['acctFlags'][0])) {
if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true; if (strrpos($attr['acctFlags'][0], 'W')) $return->smb_flagsW=true;
if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true; if (strrpos($attr['acctFlags'][0], 'D')) $return->smb_flagsD=true;
if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true; if (strrpos($attr['acctFlags'][0], 'X')) $return->smb_flagsX=true;
} }
if ($attr['domain'][0]) $return->smb_domain = $attr['domain'][0]; if (isset($attr['domain'][0])) $return->smb_domain = $attr['domain'][0];
if ($attr['pwdCanChange'][0]) $return->smb_pwdcanchange = $attr['pwdCanChange'][0]; if (isset($attr['pwdCanChange'][0])) $return->smb_pwdcanchange = $attr['pwdCanChange'][0];
if ($attr['pwdMustChange'][0]) $return->smb_pwdmustchange = $attr['pwdMustChange'][0]; if (isset($attr['pwdMustChange'][0])) $return->smb_pwdmustchange = $attr['pwdMustChange'][0];
} }
if ($attr['givenName'][0]) $return->general_givenname = $attr['givenName'][0]; if (isset($attr['givenName'][0])) $return->general_givenname = $attr['givenName'][0];
if ($attr['sn'][0]) $return->general_surname = $attr['sn'][0]; if (isset($attr['sn'][0])) $return->general_surname = $attr['sn'][0];
if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true; if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true;
return $return; return $return;
} }
@ -822,16 +825,16 @@ function loadgroup($dn) { // Will load all needed values from an existing group
$entry = ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result);
$return->general_dn = (ldap_get_dn($_SESSION['ldap']->server(), $entry)); $return->general_dn = (ldap_get_dn($_SESSION['ldap']->server(), $entry));
$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry); $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
if ($attr['gidNumber'][0]) $return->general_uidNumber = $attr['gidNumber'][0]; if (isset($attr['gidNumber'][0])) $return->general_uidNumber = $attr['gidNumber'][0];
if ($attr['description'][0]) $return->general_gecos = $attr['description'][0]; if (isset($attr['description'][0])) $return->general_gecos = $attr['description'][0];
if ($attr['cn'][0]) { if (isset($attr['cn'][0])) {
$return->general_username = $attr['cn'][0]; $return->general_username = $attr['cn'][0];
if ($_SESSION['config']->scriptServer) getquotas('group',$attr['cn'][0]); if ($_SESSION['config']->scriptServer) getquotas('group',$attr['cn'][0]);
} }
if ($attr['memberUid']) $return->general_memberUid = $attr['memberUid']; if (isset($attr['memberUid'])) $return->general_memberUid = $attr['memberUid'];
if (is_array($return->general_memberUid)) array_shift($return->general_memberUid); if (is_array($return->general_memberUid)) array_shift($return->general_memberUid);
if ($attr['sambaSID']) $return->smb_mapgroup = $attr['sambaSID']; if (isset($attr['sambaSID'])) $return->smb_mapgroup = $attr['sambaSID'];
if ($attr['displayName']) $return->smb_displayName = $attr['displayName']; if (isset($attr['displayName'])) $return->smb_displayName = $attr['displayName'];
if ($_SESSION['config']->scriptServer) { if ($_SESSION['config']->scriptServer) {
$values = getquotas('group',$return->general_username); $values = getquotas('group',$return->general_username);
if (is_object($values)) { if (is_object($values)) {

View File

@ -45,21 +45,21 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
// Write all general values into $_SESSION['account'] if no profile should be loaded // Write all general values into $_SESSION['account'] if no profile should be loaded
if (!$_POST['load']) { if (!$_POST['load']) {
$_SESSION['account']->general_dn = $_POST['f_general_suffix']; $_SESSION['account']->general_dn = $_POST['f_general_suffix'];
if ($_POST['f_general_username']) $_SESSION['account']->general_username = $_POST['f_general_username']; if (isset($_POST['f_general_username'])) $_SESSION['account']->general_username = $_POST['f_general_username'];
else $_SESSION['account']->general_username = $_POST['f_general_username']; else $_SESSION['account']->general_username = '';
if ($_POST['f_general_surname']) $_SESSION['account']->general_surname = $_POST['f_general_surname']; if (isset($_POST['f_general_surname'])) $_SESSION['account']->general_surname = $_POST['f_general_surname'];
else $_SESSION['account']->general_surname = ""; else $_SESSION['account']->general_surname = "";
if ($_POST['f_general_givenname']) $_SESSION['account']->general_givenname = $_POST['f_general_givenname']; if (isset($_POST['f_general_givenname'])) $_SESSION['account']->general_givenname = $_POST['f_general_givenname'];
else $_SESSION['account']->general_givenname = ""; else $_SESSION['account']->general_givenname = "";
if ($_POST['f_general_uidNumber']) $_SESSION['account']->general_uidNumber = $_POST['f_general_uidNumber']; if (isset($_POST['f_general_uidNumber'])) $_SESSION['account']->general_uidNumber = $_POST['f_general_uidNumber'];
else $_SESSION['account']->general_uidNumber = ""; else $_SESSION['account']->general_uidNumber = "";
if ($_POST['f_general_group']) $_SESSION['account']->general_group = $_POST['f_general_group']; if (isset($_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']; if (isset($_POST['f_general_groupadd'])) $_SESSION['account']->general_groupadd = $_POST['f_general_groupadd'];
else $_SESSION['account']->general_groupadd = array(''); else $_SESSION['account']->general_groupadd = array('');
if ($_POST['f_general_homedir']) $_SESSION['account']->general_homedir = $_POST['f_general_homedir']; if (isset($_POST['f_general_homedir'])) $_SESSION['account']->general_homedir = $_POST['f_general_homedir'];
else $_SESSION['account']->general_homedir = ""; else $_SESSION['account']->general_homedir = "";
if ($_POST['f_general_shell']) $_SESSION['account']->general_shell = $_POST['f_general_shell']; if (isset($_POST['f_general_shell'])) $_SESSION['account']->general_shell = $_POST['f_general_shell'];
if ($_POST['f_general_gecos']) $_SESSION['account']->general_gecos = $_POST['f_general_gecos']; if (isset($_POST['f_general_gecos'])) $_SESSION['account']->general_gecos = $_POST['f_general_gecos'];
else $_SESSION['account']->general_gecos = ""; else $_SESSION['account']->general_gecos = "";
// Check if values are OK and set automatic values. if not error-variable will be set // Check if values are OK and set automatic values. if not error-variable will be set
if ($_SESSION['account_old']) list($values, $errors) = checkglobal($_SESSION['account'], $_SESSION['type2'], $_SESSION['account_old']); // account.inc if ($_SESSION['account_old']) list($values, $errors) = checkglobal($_SESSION['account'], $_SESSION['type2'], $_SESSION['account_old']); // account.inc
@ -80,7 +80,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
break; break;
case 'unix': case 'unix':
// Write all general values into $_SESSION['account'] // Write all general values into $_SESSION['account']
if ($_POST['f_unix_password']) { if (isset($_POST['f_unix_password'])) {
// Encraypt password // Encraypt password
$iv = base64_decode($_COOKIE["IV"]); $iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]); $key = base64_decode($_COOKIE["Key"]);
@ -89,18 +89,15 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
else $_SESSION['account']->unix_password = ''; else $_SESSION['account']->unix_password = '';
if ($_POST['f_unix_password_no']) $_SESSION['account']->unix_password_no = true; if ($_POST['f_unix_password_no']) $_SESSION['account']->unix_password_no = true;
else $_SESSION['account']->unix_password_no = false; else $_SESSION['account']->unix_password_no = false;
if ($_POST['f_unix_pwdwarn']) $_SESSION['account']->unix_pwdwarn = $_POST['f_unix_pwdwarn']; if (isset($_POST['f_unix_pwdwarn'])) $_SESSION['account']->unix_pwdwarn = $_POST['f_unix_pwdwarn'];
else $_SESSION['account']->unix_pwdwarn = ''; else $_SESSION['account']->unix_pwdwarn = '';
if ($_POST['f_unix_pwdallowlogin']) $_SESSION['account']->unix_pwdallowlogin = $_POST['f_unix_pwdallowlogin']; if (isset($_POST['f_unix_pwdallowlogin'])) $_SESSION['account']->unix_pwdallowlogin = $_POST['f_unix_pwdallowlogin'];
else $_SESSION['account']->unix_pwdallowlogin = ''; else $_SESSION['account']->unix_pwdallowlogin = '';
if ($_POST['f_unix_pwdmaxage']) $_SESSION['account']->unix_pwdmaxage = $_POST['f_unix_pwdmaxage']; if (isset($_POST['f_unix_pwdmaxage'])) $_SESSION['account']->unix_pwdmaxage = $_POST['f_unix_pwdmaxage'];
else $_SESSION['account']->unix_pwdmaxage = ''; else $_SESSION['account']->unix_pwdmaxage = '';
if ($_POST['f_unix_pwdminage']) $_SESSION['account']->unix_pwdminage = $_POST['f_unix_pwdminage']; if (isset($_POST['f_unix_pwdminage'])) $_SESSION['account']->unix_pwdminage = $_POST['f_unix_pwdminage'];
else $_SESSION['account']->unix_pwdminage = ''; else $_SESSION['account']->unix_pwdminage = '';
//if ($_POST['f_unix_pwdexpire_day']) $_SESSION['account']->unix_pwdexpire_day = $_POST['f_unix_pwdexpire_day']; if (isset($_POST['f_unix_pwdexpire_mon'])) $_SESSION['account']->unix_pwdexpire = mktime(10, 0, 0, $_POST['f_unix_pwdexpire_mon'],
//if ($_POST['f_unix_pwdexpire_mon']) $_SESSION['account']->unix_pwdexpire_mon = $_POST['f_unix_pwdexpire_mon'];
//if ($_POST['f_unix_pwdexpire_yea']) $_SESSION['account']->unix_pwdexpire_yea = $_POST['f_unix_pwdexpire_yea'];
if ($_POST['f_unix_pwdexpire_mon']) $_SESSION['account']->unix_pwdexpire = mktime(10, 0, 0, $_POST['f_unix_pwdexpire_mon'],
$_POST['f_unix_pwdexpire_day'], $_POST['f_unix_pwdexpire_yea']); $_POST['f_unix_pwdexpire_day'], $_POST['f_unix_pwdexpire_yea']);
if ($_POST['f_unix_deactivated']) $_SESSION['account']->unix_deactivated = $_POST['f_unix_deactivated']; if ($_POST['f_unix_deactivated']) $_SESSION['account']->unix_deactivated = $_POST['f_unix_deactivated'];
else $_SESSION['account']->unix_deactivated = false; else $_SESSION['account']->unix_deactivated = false;
@ -143,16 +140,16 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
else $_SESSION['account']->smb_password_no = false; else $_SESSION['account']->smb_password_no = false;
if ($_POST['f_smb_useunixpwd']) $_SESSION['account']->smb_useunixpwd = $_POST['f_smb_useunixpwd']; if ($_POST['f_smb_useunixpwd']) $_SESSION['account']->smb_useunixpwd = $_POST['f_smb_useunixpwd'];
else $_SESSION['account']->smb_useunixpwd = false; else $_SESSION['account']->smb_useunixpwd = false;
if ($_POST['f_smb_homedrive']) $_SESSION['account']->smb_homedrive = $_POST['f_smb_homedrive']; if (isset($_POST['f_smb_homedrive'])) $_SESSION['account']->smb_homedrive = $_POST['f_smb_homedrive'];
if ($_POST['f_smb_scriptpath']) $_SESSION['account']->smb_scriptPath = $_POST['f_smb_scriptpath']; if (isset($_POST['f_smb_scriptpath'])) $_SESSION['account']->smb_scriptPath = $_POST['f_smb_scriptpath'];
else $_SESSION['account']->smb_scriptPath = ''; else $_SESSION['account']->smb_scriptPath = '';
if ($_POST['f_smb_smbuserworkstations']) $_SESSION['account']->smb_smbuserworkstations = $_POST['f_smb_smbuserworkstations']; if (isset($_POST['f_smb_smbuserworkstations'])) $_SESSION['account']->smb_smbuserworkstations = $_POST['f_smb_smbuserworkstations'];
else $_SESSION['account']->smb_smbuserworkstations = ""; else $_SESSION['account']->smb_smbuserworkstations = "";
if ($_POST['f_smb_smbhome']) $_SESSION['account']->smb_smbhome = stripslashes($_POST['f_smb_smbhome']); if (isset($_POST['f_smb_smbhome'])) $_SESSION['account']->smb_smbhome = stripslashes($_POST['f_smb_smbhome']);
else $_SESSION['account']->smb_smbhome = ""; else $_SESSION['account']->smb_smbhome = "";
if ($_POST['f_smb_profilePath']) $_SESSION['account']->smb_profilePath = stripslashes($_POST['f_smb_profilePath']); if (isset($_POST['f_smb_profilePath'])) $_SESSION['account']->smb_profilePath = stripslashes($_POST['f_smb_profilePath']);
else $_SESSION['account']->smb_profilePath = ""; else $_SESSION['account']->smb_profilePath = "";
if ($_POST['f_smb_domain']) $_SESSION['account']->smb_domain = $_POST['f_smb_domain']; if (isset($_POST['f_smb_domain'])) $_SESSION['account']->smb_domain = $_POST['f_smb_domain'];
else $_SESSION['account']->smb_domain = false; else $_SESSION['account']->smb_domain = false;
if ($_POST['f_smb_flagsW']) $_SESSION['account']->smb_flagsW = $_POST['f_smb_flagsW']; if ($_POST['f_smb_flagsW']) $_SESSION['account']->smb_flagsW = $_POST['f_smb_flagsW'];
else $_SESSION['account']->smb_flagsW = false; else $_SESSION['account']->smb_flagsW = false;
@ -163,7 +160,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
if ($_POST['f_smb_mapgroup'] == _('Domain Guests')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '514'; if ($_POST['f_smb_mapgroup'] == _('Domain Guests')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '514';
if ($_POST['f_smb_mapgroup'] == _('Domain Users')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '513'; if ($_POST['f_smb_mapgroup'] == _('Domain Users')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '513';
if ($_POST['f_smb_mapgroup'] == _('Domain Admins')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '512'; if ($_POST['f_smb_mapgroup'] == _('Domain Admins')) $_SESSION['account']->smb_mapgroup = $_SESSION[config]->get_domainSID() . "-" . '512';
if ($_POST['f_smb_domain']) $_SESSION['account']->smb_displayName = $_POST['f_smb_domain']; if (isset($_POST['f_smb_domain'])) $_SESSION['account']->smb_displayName = $_POST['f_smb_domain'];
else $_SESSION['account']->smb_displayName = ''; else $_SESSION['account']->smb_displayName = '';
// Check if values are OK and set automatic values. if not error-variable will be set // Check if values are OK and set automatic values. if not error-variable will be set
list($values, $errors) = checksamba($_SESSION['account'], $_SESSION['type2']); // account.inc list($values, $errors) = checksamba($_SESSION['account'], $_SESSION['type2']); // account.inc
@ -219,23 +216,23 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
break; break;
case 'personal': case 'personal':
// Write all general values into $_SESSION['account'] // Write all general values into $_SESSION['account']
if ($_POST['f_personal_title']) $_SESSION['account']->personal_title = $_POST['f_personal_title']; if (isset($_POST['f_personal_title'])) $_SESSION['account']->personal_title = $_POST['f_personal_title'];
else $_SESSION['account']->personal_title = ""; else $_SESSION['account']->personal_title = "";
if ($_POST['f_personal_mail']) $_SESSION['account']->personal_mail = $_POST['f_personal_mail']; if (isset($_POST['f_personal_mail'])) $_SESSION['account']->personal_mail = $_POST['f_personal_mail'];
else $_SESSION['account']->personal_mail = ""; else $_SESSION['account']->personal_mail = "";
if ($_POST['f_personal_telephoneNumber']) $_SESSION['account']->personal_telephoneNumber = $_POST['f_personal_telephoneNumber']; if (isset($_POST['f_personal_telephoneNumber'])) $_SESSION['account']->personal_telephoneNumber = $_POST['f_personal_telephoneNumber'];
else $_SESSION['account']->personal_telephoneNumber = ""; else $_SESSION['account']->personal_telephoneNumber = "";
if ($_POST['f_personal_mobileTelephoneNumber']) $_SESSION['account']->personal_mobileTelephoneNumber = $_POST['f_personal_mobileTelephoneNumber']; if (isset($_POST['f_personal_mobileTelephoneNumber'])) $_SESSION['account']->personal_mobileTelephoneNumber = $_POST['f_personal_mobileTelephoneNumber'];
else $_SESSION['account']->personal_mobileTelephoneNumber = ""; else $_SESSION['account']->personal_mobileTelephoneNumber = "";
if ($_POST['f_personal_facsimileTelephoneNumber']) $_SESSION['account']->personal_facsimileTelephoneNumber = $_POST['f_personal_facsimileTelephoneNumber']; if (isset($_POST['f_personal_facsimileTelephoneNumber'])) $_SESSION['account']->personal_facsimileTelephoneNumber = $_POST['f_personal_facsimileTelephoneNumber'];
else $_SESSION['account']->personal_facsimileTelephoneNumber = ""; else $_SESSION['account']->personal_facsimileTelephoneNumber = "";
if ($_POST['f_personal_street']) $_SESSION['account']->personal_street = $_POST['f_personal_street']; if (isset($_POST['f_personal_street'])) $_SESSION['account']->personal_street = $_POST['f_personal_street'];
else $_SESSION['account']->personal_street = ""; else $_SESSION['account']->personal_street = "";
if ($_POST['f_personal_postalCode']) $_SESSION['account']->personal_postalCode = $_POST['f_personal_postalCode']; if (isset($_POST['f_personal_postalCode'])) $_SESSION['account']->personal_postalCode = $_POST['f_personal_postalCode'];
else $_SESSION['account']->personal_postalCode = ""; else $_SESSION['account']->personal_postalCode = "";
if ($_POST['f_personal_postalAddress']) $_SESSION['account']->personal_postalAddress = $_POST['f_personal_postalAddress']; if (isset($_POST['f_personal_postalAddress'])) $_SESSION['account']->personal_postalAddress = $_POST['f_personal_postalAddress'];
else $_SESSION['account']->personal_postalAddress = ""; else $_SESSION['account']->personal_postalAddress = "";
if ($_POST['f_personal_employeeType']) $_SESSION['account']->personal_employeeType = $_POST['f_personal_employeeType']; if (isset($_POST['f_personal_employeeType'])) $_SESSION['account']->personal_employeeType = $_POST['f_personal_employeeType'];
else $_SESSION['account']->personal_employeeType = ""; else $_SESSION['account']->personal_employeeType = "";
// Check if values are OK and set automatic values. if not error-variable will be set // Check if values are OK and set automatic values. if not error-variable will be set
list($values, $errors) = checkpersonal($_SESSION['account'], $_SESSION['type2']); // account.inc list($values, $errors) = checkpersonal($_SESSION['account'], $_SESSION['type2']); // account.inc