From 193ae2c571c849d68a11c763fd789b686a694762 Mon Sep 17 00:00:00 2001 From: katagia Date: Tue, 30 Dec 2003 17:09:15 +0000 Subject: [PATCH] fixed internal problem with references --- lam/lib/modules/account.inc | 16 ++++++++-------- lam/lib/modules/inetOrgPerson.inc | 13 +++++++------ lam/lib/modules/posixAccount.inc | 12 +++++------- lam/lib/modules/posixGroup.inc | 6 ++++-- lam/lib/modules/sambaAccount.inc | 7 ++++--- lam/lib/modules/sambaGroupMapping.inc | 6 ++++-- lam/lib/modules/sambaSamAccount.inc | 7 ++++--- lam/lib/modules/shadowAccount.inc | 6 ++++-- 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index b87dc95b..133e7c0d 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -47,9 +47,8 @@ class account { if (!is_string($base)) trigger_error(_('Please create a new module object with $accountContainer->add_objectClass(\'account\');'), E_USER_ERROR); if ($_SESSION[$this->base]->get_type() != 'host') trigger_error(_('account can only be used for hosts.'), E_USER_WARNING); // load attribtues which are used in account objectClass + $this->orig = $_SESSION[$this->base]->get_module_attributes('account'); $this->attributes = $_SESSION[$this->base]->get_module_attributes('account'); - // Create copy of attributes - $this->orig = $this->attributes ; // Add objectClass to attributes $this->attributes['objectClass'][0] = 'account'; } @@ -103,6 +102,7 @@ class account { * $attr is an array as it's retured from ldap_get_attributes */ function load_attributes($attr) { + // Load attributes which are displayed // unset count entries unset ($attr['count']); $attributes = array_keys($attr); @@ -110,18 +110,18 @@ class account { // unset double entries for ($i=0; $iorig[$attribute])) { - $this->orig[$attribute] = $attr[$attribute]; + if (isset($this->attributes[$attribute])) { // decode as unicode - for ($i=0; $iorig[$attribute]); $i++) $this->orig[$attribute][$i] = utf8_decode ($this->orig[$attribute][$i]); + $this->attributes[$attribute] = $attr[$attribute]; + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Add objectClass to orig because we don't want to add objectClass if it's already set $this->orig['objectClass'][0] = 'account'; - // Values are kept as copy so we can compare old attributes with new attributes - $this->attributes = $this->orig; return 0; } diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index bda4a574..881c8014 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -102,6 +102,7 @@ class inetOrgPerson { * $attr is an array as it's retured from ldap_get_attributes */ function load_attributes($attr) { + // Load attributes which are displayed // unset count entries unset ($attr['count']); $attributes = array_keys($attr); @@ -109,18 +110,18 @@ class inetOrgPerson { // unset double entries for ($i=0; $iorig[$attribute])) { - $this->orig[$attribute] = $attr[$attribute]; + if (isset($this->attributes[$attribute])) { // decode as unicode - for ($i=0; $iorig[$attribute]); $i++) $this->orig[$attribute][$i] = utf8_decode ($this->orig[$attribute][$i]); + $this->attributes[$attribute] = $attr[$attribute]; + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Add objectClass to orig because we don't want to add objectClass if it's already set $this->orig['objectClass'][0] = 'inetOrgPerson'; - // Values are kept as copy so we can compare old attributes with new attributes - $this->attributes = $this->orig; return 0; } diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index acdc564c..0c5f017b 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -69,8 +69,8 @@ class posixAccount { if (!isset($_SESSION[$this->base]->module['inetOrgPerson']) && $_SESSION[$this->base]->type=='user') $_SESSION[$this->base]->add_objectClass('inetOrgPerson'); if (!isset($_SESSION[$this->base]->module['account']) && $_SESSION[$this->base]->type=='host') $_SESSION[$this->base]->add_objectClass('account'); // Add Array with all attributes and type + $this->orig = $_SESSION[$this->base]->get_module_attributes('posixAccount'); $this->attributes = $_SESSION[$this->base]->get_module_attributes('posixAccount'); - $_SESSION[$this->base]->add_attributes ('posixAccount'); $this->alias = _('posixAccount'); $groups = $_SESSION[$_SESSION[$this->base]->cache]->findgroups(); // list of all groupnames @@ -83,7 +83,6 @@ class posixAccount { foreach ($newattributes as $attribute) if (isset($_SESSION[$this->base]->module[$module[$i]]->attributes[$attribute])) $this->attributes[$attribute] =& $_SESSION[$this->base]->module[$module[$i]]->attributes[$attribute]; } - $this->orig = $this->attributes ; $this->attributes['objectClass'][0] = 'posixAccount'; $this->createhomedir=false; } @@ -191,12 +190,14 @@ class posixAccount { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'posixAccount'; - $this->orig = $this->attributes; // get all additional groupmemberships $dn_groups = $_SESSION[$_SESSION[$this->base]->cache]->get_cache('memberUid', 'posixGroup', 'group'); @@ -535,9 +536,6 @@ class posixAccount { * It will output a complete html-table */ function display_html_attributes($post) { - print_r($this->attributes); - print "
"; - print_r($this->attributes); $groups = $_SESSION[$_SESSION[$this->base]->cache]->findgroups(); // list of all groupnames $shelllist = getshells(); // list of all valid shells if ($this->attributes['userPassword'][0] != $this->orig['userPassword'][0]) $password=$this->userPassword(); diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 78169c96..f1e51d1d 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -178,12 +178,14 @@ class posixGroup { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'posixGroup'; - $this->orig = $this->attributes; return 0; } diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index b08d2a3a..85c73029 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -181,13 +181,14 @@ class sambaAccount { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'sambaAccount'; - $this->orig = $this->attributes; - $this->lmPassword(''); // Remove old password so it won't displayed as hash return 0; } diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 8a0e6c6e..53e628d1 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -142,12 +142,14 @@ class sambaGroupMapping { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'sambaGroupMapping'; - $this->orig = $this->attributes; return 0; } diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 68fc67e9..fd97a575 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -182,13 +182,14 @@ class sambaSamAccount { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'sambaSamAccount'; - $this->orig = $this->attributes; - $this->sambaLMPassword(''); // Remove old password so it won't displayed as hash return 0; } diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index d8eafedf..8a822b73 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -135,12 +135,14 @@ class shadowAccount { if (isset($this->attributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; - for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + for ($i=0; $iattributes[$attribute]); $i++) { + $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + } } } // Values are kept as copy so we can compare old attributes with new attributes $this->attributes['objectClass'][0] = 'shadowAccount'; - $this->orig = $this->attributes; } /* This function returns an array with 3 entries: