From 44701eca3c6c835537124daaecb9a9b32a47573c Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 14 Aug 2006 17:24:27 +0000 Subject: [PATCH] removed $post parameter --- lam/lib/modules/sambaAccount.inc | 100 ++++++++++----------- lam/lib/modules/sambaDomain.inc | 35 ++++---- lam/lib/modules/sambaGroupMapping.inc | 23 +++-- lam/lib/modules/sambaSamAccount.inc | 124 +++++++++++++------------- lam/lib/modules/shadowAccount.inc | 26 +++--- 5 files changed, 148 insertions(+), 160 deletions(-) diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index 8a26d221..36ade314 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -85,7 +85,7 @@ class sambaAccount extends baseModule { $this->messages['homeDrive'][0] = array('ERROR', _('Account %s:') . ' sambaAccount_homeDrive', _('Please enter a valid drive letter.')); $this->messages['group'][0] = array('ERROR', _('Account %s:') . ' sambaAccount_group', _('Please enter a valid group RID.')); $this->messages['specialUser'][0] = array('ERROR', _('Account %s:') . ' sambaAccount_specialUser', _('Please enter a valid special user name.')); - + } /** @@ -431,7 +431,7 @@ class sambaAccount extends baseModule { var $noexpire; /** account deactivated? */ var $deactivated; - + /** Array of well known rids */ var $rids; @@ -450,7 +450,7 @@ class sambaAccount extends baseModule { if (!$this->module_ready()) return false; if ($this->attributes['rid'][0] == '') return false; return true; - } + } /* This function loads all attributes into the object * $attr is an array as it's retured from ldap_get_attributes @@ -499,39 +499,38 @@ class sambaAccount extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_attributes(&$post) { + function process_attributes() { $errors = array(); - $this->attributes['domain'][0] = $post['domain']; + $this->attributes['domain'][0] = $_POST['domain']; // Start character $flag = "["; - if ($post['acctFlagsD']) { + if ($_POST['acctFlagsD']) { $flag .= "D"; $this->deactivated = true; } else { $this->deactivated = false; } - if ($post['acctFlagsX']) { + if ($_POST['acctFlagsX']) { $flag .= "X"; $this->noexpire = true; } else { $this->noexpire = false; } - if ($post['acctFlagsN']) { + if ($_POST['acctFlagsN']) { $flag .= "N"; $this->nopwd = true; } else { $this->nopwd = false; } - if ($post['acctFlagsS']) $flag .= "S"; - if ($post['acctFlagsH']) $flag .= "H"; - if ($post['acctFlagsW']) $flag .= "W"; - if ($post['acctFlagsU']) $flag .= "U"; + if ($_POST['acctFlagsS']) $flag .= "S"; + if ($_POST['acctFlagsH']) $flag .= "H"; + if ($_POST['acctFlagsW']) $flag .= "W"; + if ($_POST['acctFlagsU']) $flag .= "U"; // Expand string to fixed length $flag = str_pad($flag, 12); // End character @@ -539,7 +538,7 @@ class sambaAccount extends baseModule { $this->attributes['acctFlags'][0] = $flag; // display name - $this->attributes['displayName'][0] = $post['displayName']; + $this->attributes['displayName'][0] = $_POST['displayName']; if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) { $errors['displayName'][] = $this->messages['displayName'][1]; } @@ -547,7 +546,7 @@ class sambaAccount extends baseModule { // host attributes if ($_SESSION[$this->base]->type=='host') { $this->attributes['primaryGroupID'][0] = $this->rids[_('Domain Computers')]; - if ($post['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) { + if ($_POST['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) { $hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; $hostname = substr($hostname, 0, strlen($hostname) - 1); $this->attributes['lmPassword'][0] = lmPassword($hostname); @@ -557,66 +556,66 @@ class sambaAccount extends baseModule { } // check values for user account if ($this->scope == 'user') { - $this->attributes['pwdCanChange'][0] = mktime(intval($post['pwdCanChange_h']), intval($post['pwdCanChange_m']), - intval($post['pwdCanChange_s']), intval($post['pwdCanChange_mon']), intval($post['pwdCanChange_day']), - intval($post['pwdCanChange_yea'])); - $this->attributes['pwdMustChange'][0] = mktime(intval($post['pwdMustChange_h']), intval($post['pwdMustChange_m']), - intval($post['pwdMustChange_s']), intval($post['pwdMustChange_mon']), intval($post['pwdMustChange_day']), - intval($post['pwdMustChange_yea'])); - $this->attributes['smbHome'][0] = $post['smbHome']; - $this->attributes['homeDrive'][0] = $post['homeDrive']; - $this->attributes['scriptPath'][0] = $post['scriptPath']; - $this->attributes['profilePath'][0] = $post['profilePath']; + $this->attributes['pwdCanChange'][0] = mktime(intval($_POST['pwdCanChange_h']), intval($_POST['pwdCanChange_m']), + intval($_POST['pwdCanChange_s']), intval($_POST['pwdCanChange_mon']), intval($_POST['pwdCanChange_day']), + intval($_POST['pwdCanChange_yea'])); + $this->attributes['pwdMustChange'][0] = mktime(intval($_POST['pwdMustChange_h']), intval($_POST['pwdMustChange_m']), + intval($_POST['pwdMustChange_s']), intval($_POST['pwdMustChange_mon']), intval($_POST['pwdMustChange_day']), + intval($_POST['pwdMustChange_yea'])); + $this->attributes['smbHome'][0] = $_POST['smbHome']; + $this->attributes['homeDrive'][0] = $_POST['homeDrive']; + $this->attributes['scriptPath'][0] = $_POST['scriptPath']; + $this->attributes['profilePath'][0] = $_POST['profilePath']; $rids = array_keys($this->rids); $wrid = false; for ($i=0; $iattributes['primaryGroupID'][0] = $this->rids[$rids[$i]]; break; } } if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001; - if ($post['useunixpwd']) $this->useunixpwd = true; + if ($_POST['useunixpwd']) $this->useunixpwd = true; else $this->useunixpwd = false; - if ($post['useunixpwd']) { + if ($_POST['useunixpwd']) { $this->useunixpwd = true; $this->attributes['lmPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]); $this->attributes['ntPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]); $this->attributes['pwdLastSet'][0] = time(); } else $this->useunixpwd = false; - if (!$this->useunixpwd && isset($post['lmPassword']) && ($post['lmPassword'] != '')) { - if ($post['lmPassword'] != $post['lmPassword2']) { + if (!$this->useunixpwd && isset($_POST['lmPassword']) && ($_POST['lmPassword'] != '')) { + if ($_POST['lmPassword'] != $_POST['lmPassword2']) { $errors['lmPassword'][] = $this->messages['lmPassword'][0]; - unset ($post['lmPassword2']); + unset ($_POST['lmPassword2']); } else { - if ( !get_preg($post['lmPassword'], 'password')) $errors['lmPassword'][] = $this->messages['lmPassword'][1]; + if ( !get_preg($_POST['lmPassword'], 'password')) $errors['lmPassword'][] = $this->messages['lmPassword'][1]; else { - $this->attributes['lmPassword'][0] = lmPassword($post['lmPassword']); - $this->attributes['ntPassword'][0] = ntPassword($post['lmPassword']); + $this->attributes['lmPassword'][0] = lmPassword($_POST['lmPassword']); + $this->attributes['ntPassword'][0] = ntPassword($_POST['lmPassword']); $this->attributes['pwdLastSet'][0] = time(); } } } // rid $specialNames = array_keys($this->rids); - if (in_array($post['rid'], $specialNames)) { - $this->attributes['rid'][0] = $this->rids[$post['rid']]; + if (in_array($_POST['rid'], $specialNames)) { + $this->attributes['rid'][0] = $this->rids[$_POST['rid']]; } else { $this->attributes['rid'][0] = $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000; } $this->attributes['smbHome'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['smbHome'][0]); $this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]); - if ($this->attributes['smbHome'][0] != $post['smbHome']) $errors['smbHome'][] = $this->messages['homePath'][1]; + if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors['smbHome'][] = $this->messages['homePath'][1]; $this->attributes['scriptPath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['scriptPath'][0]); $this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]); - if ($this->attributes['scriptPath'][0] != $post['scriptPath']) $errors['scriptPath'][] = $this->messages['logonScript'][1]; + if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors['scriptPath'][] = $this->messages['logonScript'][1]; $this->attributes['profilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['profilePath'][0]); $this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]); - if ($this->attributes['profiletPath'][0] != $post['profilePath']) $errors['profilePath'][] = $this->messages['profilePath'][1]; + if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors['profilePath'][] = $this->messages['profilePath'][1]; if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC'))) $errors['smbHome'][] = $this->messages['homePath'][0]; if ( (!$this->attributes['scriptPath'][0]=='') && (!get_preg($this->attributes['scriptPath'][0], 'logonscript'))) @@ -644,13 +643,12 @@ class sambaAccount extends baseModule { * Processes user input of the workstation selection page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_userWorkstations(&$post) { + function process_userWorkstations() { // Load attributes if ($_SESSION[$this->base]->type=='user') { - if (isset($post['availableUserWorkstations']) && isset($post['userWorkstations_add'])) { // Add workstations to list + if (isset($_POST['availableUserWorkstations']) && isset($_POST['userWorkstations_add'])) { // Add workstations to list $temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]); $workstations = explode (',', $temp); for ($i=0; $iattributes['userWorkstations'][0] = $this->attributes['userWorkstations'][0] . "," . $workstations[$i]; } } - elseif (isset($post['userWorkstations']) && isset($post['userWorkstations_remove'])) { // remove // Add workstations from list + elseif (isset($_POST['userWorkstations']) && isset($_POST['userWorkstations_remove'])) { // remove // Add workstations from list // Put all workstations in array $temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]); $workstations = explode (',', $temp); @@ -680,7 +678,7 @@ class sambaAccount extends baseModule { } $workstations = array_values($workstations); // Remove unwanted workstations from array - $workstations = array_delete($post['userWorkstations'], $workstations); + $workstations = array_delete($_POST['userWorkstations'], $workstations); // Recreate workstation string $this->attributes['userWorkstations'][0] = $workstations[0]; for ($i=1; $i array('kind' => 'text', 'text' => _('Display name')), 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]), @@ -817,7 +815,7 @@ class sambaAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_userWorkstations(&$post) { + function display_html_userWorkstations() { if ($_SESSION[$this->base]->type=='user') { // Get list of all hosts. $result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host'); @@ -845,10 +843,10 @@ class sambaAccount extends baseModule { } return $return; } - + /** * Returns the PDF entries for this module. - * + * * @return array list of possible PDF entries */ function get_pdfEntries() { @@ -1153,8 +1151,8 @@ class sambaAccount extends baseModule { $this->deactivated = false; } } - - + + } ?> diff --git a/lam/lib/modules/sambaDomain.inc b/lam/lib/modules/sambaDomain.inc index 991a51ee..754e5466 100644 --- a/lam/lib/modules/sambaDomain.inc +++ b/lam/lib/modules/sambaDomain.inc @@ -33,7 +33,7 @@ $Id$ * @package modules */ class sambaDomain extends baseModule { - + /** * Returns meta data that is interpreted by parent class * @@ -199,13 +199,11 @@ class sambaDomain extends baseModule { $this->messages['lockoutDuration'][0] = array('ERROR', _('Lockout duration'), _('Lockout duration must be are natural number.')); $this->messages['lockoutObservationWindow'][0] = array('ERROR', _('Reset time after lockout'), _('Reset time after lockout must be are natural number.')); } - + /** * This function will create the meta HTML code to show a page with all attributes. - * - * @param array $post HTTP-POST values */ - function display_html_attributes(&$post) { + function display_html_attributes() { $return = array(); // domain name if ($_SESSION[$this->base]->isNewAccount) { @@ -240,49 +238,49 @@ class sambaDomain extends baseModule { 2 => array('kind' => 'text', 'text' => "")); /* group policies */ - + // minimum password length $return[] = array( 0 => array('kind' => 'text', 'text' => _('Minimal password length')), 1 => array('kind' => 'select', 'name' => 'minPwdLength', 'options' => array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 'options_selected' => $this->attributes['sambaMinPwdLength'][0]), - 2 => array('kind' => 'help', 'value' => 'minPwdLength')); + 2 => array('kind' => 'help', 'value' => 'minPwdLength')); // password history length $return[] = array( 0 => array('kind' => 'text', 'text' => _('Password history length')), 1 => array('kind' => 'select', 'name' => 'pwdHistLength', 'options' => array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 'options_selected' => $this->attributes['sambaPwdHistoryLength'][0]), - 2 => array('kind' => 'help', 'value' => 'pwdHistLength')); + 2 => array('kind' => 'help', 'value' => 'pwdHistLength')); // password history length $return[] = array( 0 => array('kind' => 'text', 'text' => _('Logon for password change')), 1 => array('kind' => 'select', 'name' => 'logonToChgPwd', 'options' => array(array('-', '-'), array(0, _('Off')), array(2, _('On'))), 'descriptiveOptions' => true, 'options_selected' => $this->attributes['sambaLogonToChgPwd'][0]), - 2 => array('kind' => 'help', 'value' => 'logonToChgPwd')); + 2 => array('kind' => 'help', 'value' => 'logonToChgPwd')); // force logoff $return[] = array( 0 => array('kind' => 'text', 'text' => _('Disconnect users outside logon hours')), 1 => array('kind' => 'select', 'name' => 'forceLogoff', 'options' => array(array('-', '-'), array('-1', _('Off')), array(0, _('On'))), 'descriptiveOptions' => true, 'options_selected' => $this->attributes['sambaForceLogoff'][0]), - 2 => array('kind' => 'help', 'value' => 'forceLogoff')); + 2 => array('kind' => 'help', 'value' => 'forceLogoff')); // do not allow machine password change $return[] = array( 0 => array('kind' => 'text', 'text' => _('Allow machine password changes')), 1 => array('kind' => 'select', 'name' => 'refuseMachinePwdChange', 'options' => array(array('-', '-'), array('0', _('Off')), array(1, _('On'))), 'descriptiveOptions' => true, 'options_selected' => $this->attributes['sambaRefuseMachinePwdChange'][0]), - 2 => array('kind' => 'help', 'value' => 'refuseMachinePwdChange')); + 2 => array('kind' => 'help', 'value' => 'refuseMachinePwdChange')); // Lockout users after bad logon attempts $return[] = array( 0 => array('kind' => 'text', 'text' => _('Lockout users after bad logon attempts')), 1 => array('kind' => 'select', 'name' => 'lockoutThreshold', 'options' => array(array('-', '-'), array('0', _('Off')), array(1, _('On'))), 'descriptiveOptions' => true, 'options_selected' => $this->attributes['sambaLockoutThreshold'][0]), - 2 => array('kind' => 'help', 'value' => 'lockoutThreshold')); + 2 => array('kind' => 'help', 'value' => 'lockoutThreshold')); // Minimum password age $return[] = array( 0 => array('kind' => 'text', 'text' => _('Minimum password age')), @@ -298,19 +296,19 @@ class sambaDomain extends baseModule { 0 => array('kind' => 'text', 'text' => _('Lockout duration')), 1 => array('kind' => 'input', 'name' => 'lockoutDuration', 'type' => 'text', 'value' => $this->attributes['sambaLockoutDuration'][0]), 2 => array('kind' => 'help', 'value' => 'lockoutDuration')); - // Reset time after lockout + // Reset time after lockout $return[] = array( 0 => array('kind' => 'text', 'text' => _('Reset time after lockout')), 1 => array('kind' => 'input', 'name' => 'lockoutObservationWindow', 'type' => 'text', 'value' => $this->attributes['sambaLockoutObservationWindow'][0]), 2 => array('kind' => 'help', 'value' => 'lockoutObservationWindow')); - + $return[] = array( 0 => array('kind' => 'text', 'text' => ""), 1 => array('kind' => 'text', 'text' => " "), 2 => array('kind' => 'text', 'text' => "")); - /* RID settings */ - + /* RID settings */ + // next RID $return[] = array( 0 => array('kind' => 'text', 'text' => _('Next RID')), @@ -347,10 +345,9 @@ class sambaDomain extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_attributes(&$post) { + function process_attributes() { $errors = array(); if ($_SESSION[$this->base]->isNewAccount) { // domain SID @@ -577,7 +574,7 @@ class sambaDomain extends baseModule { /** * Returns the PDF entries for this module. - * + * * @return array list of possible PDF entries */ function get_pdfEntries() { diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index c43032e2..be75b15d 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -43,7 +43,7 @@ class sambaGroupMapping extends baseModule { var $rids; /** Array of sambaGroupTypes */ var $sambaGroupTypes; - + /** * Creates a new module for Samba 3 groups. * @@ -167,7 +167,7 @@ class sambaGroupMapping extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes(&$post) { + function display_html_attributes() { $sambaDomains = search_domains(); if (sizeof($sambaDomains) == 0) { StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), ''); @@ -309,14 +309,14 @@ class sambaGroupMapping extends baseModule { "Text" => _("Windows group type.") ) ); - + return $return; } /** * Returns the PDF entries for this module. - * + * * @return array list of possible PDF entries */ function get_pdfEntries() { @@ -399,33 +399,32 @@ class sambaGroupMapping extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_attributes(&$post) { + function process_attributes() { $errors = array(); $sambaDomains = search_domains(); if (sizeof($sambaDomains) == 0) { return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.')))); } // Save attributes - $this->attributes['displayName'][0] = $post['displayName']; - $this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']]; + $this->attributes['displayName'][0] = $_POST['displayName']; + $this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$_POST['sambaGroupType']]; // Get Domain SID from name for ($i=0; $iname) { + if (!isset($_POST['sambaDomainName'])) break; + if ($_POST['sambaDomainName'] == $sambaDomains[$i]->name) { $SID = $sambaDomains[$i]->SID; $RIDbase = $sambaDomains[$i]->RIDbase; } } // Load attributes - $this->attributes['displayName'][0] = $post['displayName']; + $this->attributes['displayName'][0] = $_POST['displayName']; $rids = array_keys($this->rids); $wrid = false; for ($i=0; $iattributes['sambaSID'][0] = $SID."-".$this->rids[$rids[$i]]; diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 9c2ef2be..1866925c 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -52,7 +52,7 @@ class sambaSamAccount extends baseModule { var $hex2bitstring = array('0' => '0000', '1' => '0001', '2' => '0010', '3' => '0011', '4' => '0100', '5' => '0101', '6' => '0110', '7' => '0111', '8' => '1000', '9' => '1001', 'A' => '1010', 'B' => '1011', 'C' => '1100', 'D' => '1101', 'E' => '1110', 'F' => '1111'); - + /** * Creates a new sambaSamAccount object. @@ -104,7 +104,7 @@ class sambaSamAccount extends baseModule { $this->messages['logonHours'][1] = array('ERROR', _('Account %s:') . ' sambaSamAccount_logonHours', _('The format of the logon hours field is invalid!')); $this->messages['group'][0] = array('ERROR', _('Account %s:') . ' sambaSamAccount_group', _('Please enter a valid group name!')); } - + /** * Returns meta data that is interpreted by parent class * @@ -127,7 +127,7 @@ class sambaSamAccount extends baseModule { // managed object classes $return['objectClasses'] = array('sambaSamAccount'); // managed attributes - $return['attributes'] = array('uid', 'sambaSID', 'sambaLMPassword', 'sambaNTPassword', 'sambaPwdLastSet', + $return['attributes'] = array('uid', 'sambaSID', 'sambaLMPassword', 'sambaNTPassword', 'sambaPwdLastSet', 'sambaLogonTime', 'sambaLogoffTime', 'sambaKickoffTime', 'sambaPwdCanChange', 'sambaPwdMustChange', 'sambaAcctFlags', 'displayName', 'sambaHomePath', 'sambaHomeDrive', 'sambaLogonScript', 'sambaProfilePath', 'sambaUserWorkstations', 'sambaPrimaryGroupSID', 'sambaDomainName', 'sambaLogonHours'); @@ -494,7 +494,7 @@ class sambaSamAccount extends baseModule { if ($this->attributes['sambaSID'][0] == '') return false; return true; } - + /* This function loads all attributes into the object * $attr is an array as it's retured from ldap_get_attributes */ @@ -544,17 +544,16 @@ class sambaSamAccount extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_attributes(&$post) { + function process_attributes() { $errors = array(); $sambaDomains = search_domains(); if (sizeof($sambaDomains) == 0) { return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.')))); } // Save attributes - $this->attributes['sambaDomainName'][0] = $post['sambaDomainName']; + $this->attributes['sambaDomainName'][0] = $_POST['sambaDomainName']; // Get Domain SID from name for ($i=0; $iattributes['sambaDomainName'][0] == $sambaDomains[$i]->name) { @@ -562,31 +561,31 @@ class sambaSamAccount extends baseModule { $RIDbase = $sambaDomains[$i]->RIDbase; } $flag = "["; - if ($post['sambaAcctFlagsD']) { + if ($_POST['sambaAcctFlagsD']) { $flag .= "D"; $this->deactivated = true; } else { $this->deactivated = false; } - if ($post['sambaAcctFlagsX']) { + if ($_POST['sambaAcctFlagsX']) { $flag .= "X"; $this->noexpire = true; } else { $this->noexpire = false; } - if ($post['sambaAcctFlagsN']) { + if ($_POST['sambaAcctFlagsN']) { $flag .= "N"; $this->nopwd = true; } else { $this->nopwd = false; } - if ($post['sambaAcctFlagsS']) $flag .= "S"; - if ($post['sambaAcctFlagsH']) $flag .= "H"; - if ($post['sambaAcctFlagsW']) $flag .= "W"; - if ($post['sambaAcctFlagsU']) $flag .= "U"; + if ($_POST['sambaAcctFlagsS']) $flag .= "S"; + if ($_POST['sambaAcctFlagsH']) $flag .= "H"; + if ($_POST['sambaAcctFlagsW']) $flag .= "W"; + if ($_POST['sambaAcctFlagsU']) $flag .= "U"; // Expand string to fixed length $flag = str_pad($flag, 12); // End character @@ -594,7 +593,7 @@ class sambaSamAccount extends baseModule { $this->attributes['sambaAcctFlags'][0] = $flag; // display name - $this->attributes['displayName'][0] = $post['displayName']; + $this->attributes['displayName'][0] = $_POST['displayName']; if (!($this->attributes['displayName'][0] == '') && !(get_preg($this->attributes['displayName'][0], 'realname'))) { $errors['displayName'][] = $this->messages['displayName'][1]; } @@ -602,7 +601,7 @@ class sambaSamAccount extends baseModule { // host attributes if ($_SESSION[$this->base]->type=='host') { $this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[_('Domain Computers')]; - if ($post['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) { + if ($_POST['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) { $hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; $hostname = substr($hostname, 0, strlen($hostname) - 1); $this->attributes['sambaLMPassword'][0] = lmPassword($hostname); @@ -612,26 +611,26 @@ class sambaSamAccount extends baseModule { } // user attributes if ($_SESSION[$this->base]->type=='user') { - $this->attributes['sambaPwdCanChange'][0] = mktime(intval($post['sambaPwdCanChange_h']), intval($post['sambaPwdCanChange_m']), - intval($post['sambaPwdCanChange_s']), intval($post['sambaPwdCanChange_mon']), intval($post['sambaPwdCanChange_day']), - intval($post['sambaPwdCanChange_yea'])); - $this->attributes['sambaPwdMustChange'][0] = mktime(intval($post['sambaPwdMustChange_h']), intval($post['sambaPwdMustChange_m']), - intval($post['sambaPwdMustChange_s']), intval($post['sambaPwdMustChange_mon']), intval($post['sambaPwdMustChange_day']), - intval($post['sambaPwdMustChange_yea'])); - $this->attributes['sambaKickoffTime'][0] = mktime(intval($post['sambaExpire_h']), intval($post['sambaExpire_m']), - intval($post['sambaExpire_s']), intval($post['sambaExpire_mon']), intval($post['sambaExpire_day']), - intval($post['sambaExpire_yea'])); - $this->attributes['sambaHomePath'][0] = $post['sambaHomePath']; - if ($post['sambaHomeDrive'] == "-") + $this->attributes['sambaPwdCanChange'][0] = mktime(intval($_POST['sambaPwdCanChange_h']), intval($_POST['sambaPwdCanChange_m']), + intval($_POST['sambaPwdCanChange_s']), intval($_POST['sambaPwdCanChange_mon']), intval($_POST['sambaPwdCanChange_day']), + intval($_POST['sambaPwdCanChange_yea'])); + $this->attributes['sambaPwdMustChange'][0] = mktime(intval($_POST['sambaPwdMustChange_h']), intval($_POST['sambaPwdMustChange_m']), + intval($_POST['sambaPwdMustChange_s']), intval($_POST['sambaPwdMustChange_mon']), intval($_POST['sambaPwdMustChange_day']), + intval($_POST['sambaPwdMustChange_yea'])); + $this->attributes['sambaKickoffTime'][0] = mktime(intval($_POST['sambaExpire_h']), intval($_POST['sambaExpire_m']), + intval($_POST['sambaExpire_s']), intval($_POST['sambaExpire_mon']), intval($_POST['sambaExpire_day']), + intval($_POST['sambaExpire_yea'])); + $this->attributes['sambaHomePath'][0] = $_POST['sambaHomePath']; + if ($_POST['sambaHomeDrive'] == "-") $this->attributes['sambaHomeDrive'][0] = ''; else - $this->attributes['sambaHomeDrive'][0] = $post['sambaHomeDrive']; - $this->attributes['sambaLogonScript'][0] = $post['sambaLogonScript']; - $this->attributes['sambaProfilePath'][0] = $post['sambaProfilePath']; + $this->attributes['sambaHomeDrive'][0] = $_POST['sambaHomeDrive']; + $this->attributes['sambaLogonScript'][0] = $_POST['sambaLogonScript']; + $this->attributes['sambaProfilePath'][0] = $_POST['sambaProfilePath']; $rids = array_keys($this->rids); $wrid = false; for ($i=0; $iattributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[$rids[$i]]; @@ -651,34 +650,34 @@ class sambaSamAccount extends baseModule { } } - if ($post['useunixpwd']) { + if ($_POST['useunixpwd']) { $this->useunixpwd = true; $this->attributes['sambaLMPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]); $this->attributes['sambaNTPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]); $this->attributes['sambaPwdLastSet'][0] = time(); } else $this->useunixpwd = false; - if (!$this->useunixpwd && isset($post['sambaLMPassword']) && ($post['sambaLMPassword'] != '')) { - if ($post['sambaLMPassword'] != $post['sambaLMPassword2']) { + if (!$this->useunixpwd && isset($_POST['sambaLMPassword']) && ($_POST['sambaLMPassword'] != '')) { + if ($_POST['sambaLMPassword'] != $_POST['sambaLMPassword2']) { $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][0]; - unset ($post['sambaLMPassword2']); + unset ($_POST['sambaLMPassword2']); } else { - if (!get_preg($post['sambaLMPassword'], 'password')) $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][1]; + if (!get_preg($_POST['sambaLMPassword'], 'password')) $errors['sambaLMPassword'][] = $this->messages['sambaLMPassword'][1]; else { - $this->attributes['sambaLMPassword'][0] = lmPassword($post['sambaLMPassword']); - $this->attributes['sambaNTPassword'][0] = ntPassword($post['sambaLMPassword']); + $this->attributes['sambaLMPassword'][0] = lmPassword($_POST['sambaLMPassword']); + $this->attributes['sambaNTPassword'][0] = ntPassword($_POST['sambaLMPassword']); $this->attributes['sambaPwdLastSet'][0] = time(); } } } $specialRids = array_flip($this->rids); // set special RID if selected - if (in_array($post['sambaSID'], $specialRids)) { - $this->attributes['sambaSID'][0] = $SID . '-' . $this->rids[$post['sambaSID']]; + if (in_array($_POST['sambaSID'], $specialRids)) { + $this->attributes['sambaSID'][0] = $SID . '-' . $this->rids[$_POST['sambaSID']]; } // standard RID - else if ($post['sambaSID'] == "-") { + else if ($_POST['sambaSID'] == "-") { $rid = substr($this->attributes['sambaSID'][0], strrpos($this->attributes['sambaSID'][0], '-') + 1, strlen($this->attributes['sambaSID'][0])); // change only if not yet set or previously set to special SID if (!$this->attributes['sambaSID'][0] || in_array($rid, $this->rids)) { @@ -688,13 +687,13 @@ class sambaSamAccount extends baseModule { // Check values $this->attributes['sambaHomePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaHomePath'][0]); $this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]); - if ($this->attributes['sambaHomePath'][0] != $post['sambaHomePath']) $errors['sambaHomePath'][] = $this->messages['homePath'][1]; + if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors['sambaHomePath'][] = $this->messages['homePath'][1]; $this->attributes['sambaLogonScript'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]); $this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]); - if ($this->attributes['sambaLogonScript'][0] != $post['sambaLogonScript']) $errors['sambaLogonScript'][] = $this->messages['logonScript'][1]; + if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors['sambaLogonScript'][] = $this->messages['logonScript'][1]; $this->attributes['sambaProfilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]); $this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]); - if ($this->attributes['sambaProfilePath'][0] != $post['sambaProfilePath']) $errors['sambaProfilePath'][] = $this->messages['profilePath'][1]; + if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors['sambaProfilePath'][] = $this->messages['profilePath'][1]; if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC'))) $errors['sambaHomePath'][] = $this->messages['homePath'][0]; if ( (!$this->attributes['sambaLogonScript'][0]=='') && (!get_preg($this->attributes['sambaLogonScript'][0], 'logonscript'))) @@ -715,13 +714,12 @@ class sambaSamAccount extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_sambaUserWorkstations($post) { + function process_sambaUserWorkstations() { // Load attributes if ($_SESSION[$this->base]->type=='user') { - if (isset($post['availableSambaUserWorkstations']) && isset($post['sambaUserWorkstations_add'])) { // Add workstations to list + if (isset($_POST['availableSambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_add'])) { // Add workstations to list $temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]); $workstations = explode (',', $temp); for ($i=0; $iattributes['sambaUserWorkstations'][0] = $this->attributes['sambaUserWorkstations'][0] . "," . $workstations[$i]; } } - elseif (isset($post['sambaUserWorkstations']) && isset($post['sambaUserWorkstations_remove'])) { // remove // Add workstations from list + elseif (isset($_POST['sambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_remove'])) { // remove // Add workstations from list // Put all workstations in array $temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]); $workstations = explode (',', $temp); @@ -751,7 +749,7 @@ class sambaSamAccount extends baseModule { } $workstations = array_values($workstations); // Remove unwanted workstations from array - $workstations = array_delete($post['sambaUserWorkstations'], $workstations); + $workstations = array_delete($_POST['sambaUserWorkstations'], $workstations); // Recreate workstation string $this->attributes['sambaUserWorkstations'][0] = $workstations[0]; for ($i=1; $ihex2bitstring); @@ -787,12 +784,12 @@ class sambaSamAccount extends baseModule { } $this->attributes['sambaLogonHours'][0] = $logonHoursNew; } - + /* This function will create the html-page * to show a page with all attributes. * It will output a complete html-table */ - function display_html_attributes($post) { + function display_html_attributes() { // Get Domain SID from user SID $sambaDomains = search_domains(); if (sizeof($sambaDomains) == 0) { @@ -968,7 +965,7 @@ class sambaSamAccount extends baseModule { * to show a page with all attributes. * It will output a complete html-table */ - function display_html_sambaUserWorkstations($post) { + function display_html_sambaUserWorkstations() { if ($_SESSION[$this->base]->type=='user') { // Get list of all hosts. $result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host'); @@ -1000,10 +997,9 @@ class sambaSamAccount extends baseModule { /** * This function will create the HTML page to edit logon hours. * - * @param array $post HTTP POST variables * @return array meta HTML code */ - function display_html_logonHours($post) { + function display_html_logonHours() { $timeZone = 0; if (isset($this->moduleSettings['sambaSamAccount_timeZone']) && is_array($this->moduleSettings['sambaSamAccount_timeZone'])) { $timeZone = $this->moduleSettings['sambaSamAccount_timeZone'][0]; @@ -1185,7 +1181,7 @@ class sambaSamAccount extends baseModule { } return $return; } - + /** * Loads the values of an account profile into internal variables. * @@ -1274,13 +1270,13 @@ class sambaSamAccount extends baseModule { $this->attributes['sambaPrimaryGroupSID'][0] = $domSID . "-" . $profile['sambaSamAccount_group'][0]; } } - + } } /** * Returns the PDF entries for this module. - * + * * @return array list of possible PDF entries */ function get_pdfEntries() { @@ -1531,8 +1527,8 @@ class sambaSamAccount extends baseModule { $partialAccounts[$i]['sambaPrimaryGroupSID'] = $groups_cn[$rawAccounts[$i][$ids['sambaSamAccount_group']]]['SID']; } else { - $partialAccounts[$i]['sambaPrimaryGroupSID'] = $domains[$domIndex]->SID . '-' . - ($groups_cn[$rawAccounts[$i][$ids['sambaSamAccount_group']]]['gid'] * 2 + + $partialAccounts[$i]['sambaPrimaryGroupSID'] = $domains[$domIndex]->SID . '-' . + ($groups_cn[$rawAccounts[$i][$ids['sambaSamAccount_group']]]['gid'] * 2 + $domains[$domIndex]->RIDbase + 1); } } diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 11c22dcd..a80030de 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -54,7 +54,7 @@ class shadowAccount extends baseModule { $this->messages['shadow_cmp'][1] = array('ERROR', _('Account %s:') . ' shadowAccount_min/maxAge', _('Password maximum age must be bigger as password minimum age.')); $this->messages['shadow_expireDate'][0] = array('ERROR', _('Account %s:') . ' shadowAccount_expireDate', _('The expiration date is invalid.')); } - + /** * Returns meta data that is interpreted by parent class * @@ -231,7 +231,7 @@ class shadowAccount extends baseModule { $modules = $_SESSION['config']->get_AccountModules($this->get_scope()); if (in_array('posixAccount', $modules)) { if (isset($return[$_SESSION[$this->base]->dn]['modify']['userPassword'])) { - unset($return[$_SESSION[$this->base]->dn]['modify']['userPassword']); + unset($return[$_SESSION[$this->base]->dn]['modify']['userPassword']); } if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword'])) { unset($return[$_SESSION[$this->base]->dn]['add']['userPassword']); @@ -244,18 +244,17 @@ class shadowAccount extends baseModule { * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. * - * @param array $post HTTP-POST values * @return array list of info/error messages */ - function process_attributes(&$post) { + function process_attributes() { $errors = array(); // Load attributes - $this->attributes['shadowMin'][0] = $post['shadowMin']; - $this->attributes['shadowMax'][0] = $post['shadowMax']; - $this->attributes['shadowWarning'][0] = $post['shadowWarning']; - $this->attributes['shadowInactive'][0] = $post['shadowInactive']; - $this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($post['shadowExpire_mon']), intval($post['shadowExpire_day']), - intval($post['shadowExpire_yea']))/3600/24); + $this->attributes['shadowMin'][0] = $_POST['shadowMin']; + $this->attributes['shadowMax'][0] = $_POST['shadowMax']; + $this->attributes['shadowWarning'][0] = $_POST['shadowWarning']; + $this->attributes['shadowInactive'][0] = $_POST['shadowInactive']; + $this->attributes['shadowExpire'][0] = intval(mktime(0, 0, 0, intval($_POST['shadowExpire_mon']), intval($_POST['shadowExpire_day']), + intval($_POST['shadowExpire_yea']))/3600/24); if ( !get_preg($this->attributes['shadowMin'][0], 'digit')) $errors['shadowMin'][] = $this->messages['shadowMin'][0]; if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $errors['shadowMax'][] = $this->messages['shadowMax'][0]; if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $errors['shadowMin'][] = $this->messages['shadow_cmp'][0]; @@ -267,10 +266,9 @@ class shadowAccount extends baseModule { /** * This function will create the meta HTML code to show a page with all attributes. * - * @param array $post HTTP POST data * @return array meta HTML code */ - function display_html_attributes(&$post) { + function display_html_attributes() { // Use dd-mm-yyyy format of date because it's easier to read for humans $shAccExpirationDate = 0; if (isset($this->attributes['shadowExpire'][0])) $shAccExpirationDate = $this->attributes['shadowExpire'][0]; @@ -314,7 +312,7 @@ class shadowAccount extends baseModule { /** * Returns the PDF entries for this module. - * + * * @return array list of possible PDF entries */ function get_pdfEntries() { @@ -423,7 +421,7 @@ class shadowAccount extends baseModule { $this->attributes['shadowExpire'][0] = $date; } } - + } ?>