From: cajus Date: Wed, 10 May 2006 10:03:39 +0000 (+0000) Subject: - modified a set of ldap->cat X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9661305ec872b58877cee3ac6b772134dcf7282c;p=gosa.git - modified a set of ldap->cat - fixed a set of fetch(cat) combinations - layout fixes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3266 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/TODO b/TODO index 4e0956784..3a7cfd1d2 100644 --- a/TODO +++ b/TODO @@ -29,11 +29,10 @@ Target for 2.4.1: Now: * Add iframe progress for departments when handling tagging -* What about unitTag's when moving objects? - - ok for departments - everything is copied here anyway - - single object moving has to be checked -* Check several ldap->cat() for needed attributes +* check class_plugin.inc and what effects a ldap->cat(..., $this->attributes) + will have to other plugins * Enhance show_ldap_error() with an additional programmer supplied message +* Change FAIstate when triggering actions Target for 2.5: diff --git a/html/getFAIscript.php b/html/getFAIscript.php index e86bdcc78..b22451a67 100644 --- a/html/getFAIscript.php +++ b/html/getFAIscript.php @@ -24,7 +24,7 @@ restore_error_handler(); $ldap = $_SESSION['config']->get_ldap_link(); $ldap->cd($_SESSION['config']->current['BASE']); - $sr= $ldap->cat($id); + $sr= $ldap->cat($id, array("FAItemplateFile", "FAIscript", "cn", "objectClass")); $ei= ldap_first_entry($ldap->cid, $sr); if(isset($_GET['is_template'])){ $tmp = ldap_get_values_len($ldap->cid, $ei,"FAItemplateFile"); diff --git a/html/index.php b/html/index.php index e1baef37c..dd9cc28b9 100644 --- a/html/index.php +++ b/html/index.php @@ -172,7 +172,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){ } } /* Check for locking area */ - $ldap->cat($config->current['CONFIG']); + $ldap->cat($config->current['CONFIG'], array("dn")); $attrs= $ldap->fetch(); if (!count ($attrs)){ $ldap->cd($config->current['BASE']); diff --git a/include/class_ldap.inc b/include/class_ldap.inc index f8546bdf7..94ae4c924 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -267,6 +267,7 @@ class LDAP{ function fetch() { + $att= array(); if($this->hascon){ if($this->hasres){ if ($this->start == 0) diff --git a/include/class_password-methods.inc b/include/class_password-methods.inc index c0ffba2b6..97571da79 100644 --- a/include/class_password-methods.inc +++ b/include/class_password-methods.inc @@ -102,7 +102,7 @@ function change_password ($dn, $password, $mode=0, $hash= "") // read current password entry for $dn, to detect the encryption Method $ldap = $config->get_ldap_link(); - $ldap->cat ($dn); + $ldap->cat ($dn, array("shadowLastChange", "userPassword")); $attrs = $ldap->fetch (); // Set encryption type to clear if required diff --git a/include/class_plugin.inc b/include/class_plugin.inc index c769b8fc3..bab07709a 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -622,7 +622,7 @@ class plugin /* Try to use plain entry first */ $dn= "$attribute=".$this->$attribute.",$base"; - $ldap->cat ($dn); + $ldap->cat ($dn, array('dn')); if (!$ldap->fetch()){ return ($dn); } @@ -634,7 +634,7 @@ class plugin } $dn= "$attribute=".$this->$attribute."+$attr=".$this->$attr.",$base"; - $ldap->cat ($dn); + $ldap->cat ($dn, array('dn')); if (!$ldap->fetch()){ return ($dn); } @@ -681,7 +681,6 @@ class plugin } $ldap->cat($src_dn); - $attrs= array(); $attrs= $ldap->fetch(); if (!count($attrs)){ trigger_error("Trying to move $src_dn, which does not seem to exist.", @@ -780,7 +779,7 @@ class plugin $ldap= $this->config->get_ldap_link(); /* Check if destination exists - abort */ - $ldap->cat($dst_dn); + $ldap->cat($dst_dn, array('dn')); if ($ldap->fetch()){ trigger_error("recursive_move $dst_dn already exists.", E_USER_WARNING); @@ -903,7 +902,7 @@ class plugin if ($tag != ""){ /* Set objectclass and attribute */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($dn); + $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); $attrs= $ldap->fetch(); if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){ echo "DEBUG: $dn is already tagged
"; @@ -929,7 +928,7 @@ class plugin } else { /* Remove objectclass and attribute */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($dn); + $ldap->cat($dn, array('gosaUnitTag', 'objectClass')); $attrs= $ldap->fetch(); if (!in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){ echo "DEBUG: $dn is not tagged
"; diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 79e952679..5ac469a84 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -34,7 +34,7 @@ class userinfo function userinfo($config, $userdn){ $this->config= $config; $ldap= $this->config->get_ldap_link(); - $ldap->cat($userdn); + $ldap->cat($userdn,array('sn', 'givenName', 'uid', 'gidNumber', 'preferredLanguage')); $attrs= $ldap->fetch(); if (isset($attrs['givenName'][0]) && isset($attrs['sn'][0])){ diff --git a/include/functions.inc b/include/functions.inc index 94ec5b80d..0bedbcee8 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -996,15 +996,12 @@ function gen_locked_message($user, $dn) $_SESSION['dn']= $dn; $ldap= $config->get_ldap_link(); - $ldap->cat ($user); + $ldap->cat ($user, array('uid', 'cn')); $attrs= $ldap->fetch(); $uid= $attrs["uid"][0]; $cn= $attrs["cn"][0]; $remove= false; - // print_a($_POST); - // print_a($_GET); - if((isset($_SESSION['LOCK_VARS_TO_USE']))&&(count($_SESSION['LOCK_VARS_TO_USE']))){ $_SESSION['LOCK_VARS_USED'] =array(); foreach($_SESSION['LOCK_VARS_TO_USE'] as $name){ @@ -1129,10 +1126,14 @@ function show_errors($message) } -function show_ldap_error($message) +function show_ldap_error($message, $addon= "") { if (!preg_match("/Success/i", $message)){ - print_red (_("LDAP error:")." $message"); + if ($addon == ""){ + print_red (_("LDAP error:")." $message"); + } else { + print_red ("$addon (LDAP error: $message)"); + } return TRUE; } else { return FALSE; diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc index 63415e90e..0f71b2eac 100644 --- a/plugins/addons/addressbook/class_addressbook.inc +++ b/plugins/addons/addressbook/class_addressbook.inc @@ -125,7 +125,7 @@ class addressbook extends plugin /* Get target */ $ldap= $this->config->get_ldap_link(); - $ldap->cat(base64_decode($_GET['target'])); + $ldap->cat(base64_decode($_GET['target']), array('telephoneNumber', 'mobile', 'homePhone')); $attrs= $ldap->fetch(); if (isset($attrs["$dialmode"])){ $target= $attrs[$dialmode][0]; @@ -135,7 +135,7 @@ class addressbook extends plugin /* Get source */ $ui= get_userinfo(); - $ldap->cat($ui->dn); + $ldap->cat($ui->dn, array('telephoneNumber')); $attrs= $ldap->fetch(); if (isset($attrs["telephoneNumber"])){ $source= $attrs['telephoneNumber'][0]; @@ -439,7 +439,7 @@ class addressbook extends plugin /* Fill variables from LDAP */ if ($_SESSION['show_info'] != "ADD"){ - $ldap->cat($_SESSION['show_info']); + $ldap->cat($_SESSION['show_info'], $this->attributes); $info= $ldap->fetch(); } foreach ($this->attributes as $name){ @@ -634,7 +634,7 @@ class addressbook extends plugin /* Save data. Using 'modify' implies that the entry is already present, use 'add' for new entries. So do a check first... */ $ldap= $this->config->get_ldap_link(); - $ldap->cat ($this->dn); + $ldap->cat ($this->dn,array('dn')); if ($ldap->fetch()){ $mode= "modify"; } else { diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index da52cb304..c50184cf9 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -370,7 +370,7 @@ class application extends plugin /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); if (count($a)){ diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 6d0343ade..5086303fc 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -208,7 +208,7 @@ class department extends plugin /* Check for presence of this department */ $ldap= $this->config->get_ldap_link(); - $attrs= $ldap->cat ($this->dn); + $attrs= $ldap->cat ($this->dn, array('dn')); if ($this->orig_dn == "new" && !($attrs === FALSE)){ $message[]= _("Department with that 'Name' already exists."); } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){ @@ -303,7 +303,7 @@ class department extends plugin /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); $ldap->cd($this->dn); @@ -405,7 +405,7 @@ class department extends plugin $ldap= $this->config->get_ldap_link(); /* Check if destination exists - abort */ - $ldap->cat($dst_dn); + $ldap->cat($dst_dn, array('dn')); if ($ldap->fetch()){ trigger_error("Recursive_move $dst_dn already exists.", E_USER_WARNING); diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 3f1be86de..7bf6e75bd 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -251,7 +251,7 @@ class faiManagement extends plugin /* Find out more about the object type */ $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('objectClass')); $attrs = $ldap->fetch(); $type = $this->get_type($attrs); diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 70d2096d4..43ca39a03 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -443,7 +443,7 @@ class faiPackage extends plugin // $this->attrs["FAIinstallMethod"]= "aptitude"; - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if($ldap->count()!=0){ /* Write FAIscript to ldap*/ $ldap->cd($this->dn); diff --git a/plugins/admin/fai/class_faiSummaryTab.inc b/plugins/admin/fai/class_faiSummaryTab.inc index fbe589efd..c018ea8f3 100644 --- a/plugins/admin/fai/class_faiSummaryTab.inc +++ b/plugins/admin/fai/class_faiSummaryTab.inc @@ -151,7 +151,7 @@ class faiSummaryTab extends plugin{ if(isset($_GET['show'])){ $ldap = $this->config->get_ldap_link(); - $ldap->cat(base64_decode($_GET['id'])); + $ldap->cat(base64_decode($_GET['id']), array('FAIscript', 'FAIhook', 'FAItemplate')); $attrs = $ldap->fetch(); if($_GET['type'] == "FAIscript"){ $str = $attrs['FAIscript'][0]; diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index b7e18d58a..c7f5b7b6d 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -504,11 +504,10 @@ class appgroup extends plugin $found = $attrs['dn']; } } - $ldap->cat($found); + $ldap->cat($found, array("gosaApplicationParameter")); }else{ $ldap->cd($this->config->current['BASE']); $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter")); - } diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 61a631314..5d32a551b 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -663,7 +663,7 @@ class group extends plugin /* Save data. Using 'modify' implies that the entry is already present, use 'add' for new entries. So do a check first... */ - $ldap->cat ($this->dn); + $ldap->cat ($this->dn, array('dn')); if ($ldap->fetch()){ /* Modify needs array() to remove values :-( */ if (!count ($this->memberUid)){ diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 81afff4e3..6e6004fba 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -642,7 +642,7 @@ class ogroup extends plugin $ldap = $this->config->get_ldap_link(); if($this->dn != $new_dn){ - $ldap->cat ($new_dn); + $ldap->cat ($new_dn, array('dn')); } if($ldap->count() !=0){ @@ -690,7 +690,7 @@ class ogroup extends plugin /* Save data. Using 'modify' implies that the entry is already present, use 'add' for new entries. So do a check first... */ - $ldap->cat ($this->dn); + $ldap->cat ($this->dn, array('dn')); if ($ldap->fetch()){ /* Modify needs array() to remove values :-( */ if (!count ($this->member)){ diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc index b33232e1f..7d68d846d 100644 --- a/plugins/admin/ogroups/class_termgroup.inc +++ b/plugins/admin/ogroups/class_termgroup.inc @@ -19,7 +19,7 @@ class termgroup extends plugin if(isset($this->attrs['member'])){ for ($i= 0; $i<$this->attrs['member']['count']; $i++){ $member= $this->attrs['member'][$i]; - $ldap->cat($member); + $ldap->cat($member, array('objectClass', 'macAddress', 'cn')); if (preg_match("/success/i", $ldap->error)){ $attrs = $ldap->fetch(); if (in_array("gotoTerminal", $attrs['objectClass']) || diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc index 0f8733c95..1ea5cab2c 100644 --- a/plugins/admin/systems/class_glpiAccount.inc +++ b/plugins/admin/systems/class_glpiAccount.inc @@ -492,7 +492,8 @@ class glpiAccount extends plugin if(!in_array($id,$users)){ /* If this user doesn't exists in glpi db, we must create him */ - $atr = $ldap->fetch($ldap->cat($id)); + $ldap->cat($id, array('cn', 'mail', 'telephoneNumber')); + $atr = $ldap->fetch(); $tmp = array(); $use = array( "cn" =>"name", "mail" =>"email", @@ -621,7 +622,8 @@ class glpiAccount extends plugin Assign name ... to smarty, if set */ if(isset($users[$this->contact_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->contact_num])); + $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } @@ -635,7 +637,8 @@ class glpiAccount extends plugin Assign name ... to smarty, if set */ if(isset($users[$this->tech_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->tech_num])); + $tr = $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc index 4ee03e31a..ea5a02ef6 100644 --- a/plugins/admin/systems/class_glpiPrinterAccount.inc +++ b/plugins/admin/systems/class_glpiPrinterAccount.inc @@ -376,7 +376,8 @@ class glpiPrinterAccount extends plugin if(!in_array($id,$users)){ /* If this user doesn't exists in glpi db, we must create him */ - $atr = $ldap->fetch($ldap->cat($id)); + $ldap->cat($id, array('cn', 'mail', 'telephoneNumber')); + $atr = $ldap->fetch(); $tmp = array(); $use = array( "cn" =>"name", "mail" =>"email", @@ -599,7 +600,8 @@ class glpiPrinterAccount extends plugin * Assign contact and technical responsible person */ if(isset($users[$this->contact_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->contact_num])); + $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } @@ -613,7 +615,8 @@ class glpiPrinterAccount extends plugin Assign name ... to smarty, if set */ if(isset($users[$this->tech_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->tech_num])); + $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc index c43a3f112..7830396ed 100644 --- a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc +++ b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc @@ -180,7 +180,8 @@ class glpiPrinterCartridgesEdit extends plugin if(!in_array($id,$users)){ /* If this user doesn't exists in glpi db, we must create him */ - $atr = $ldap->fetch($ldap->cat($id)); + $ldap->cat($id, array('cn', 'mail', 'telephoneNumber')); + $atr = $ldap->fetch(); $tmp = array(); $use = array( "cn" =>"name", "mail" =>"email", @@ -278,7 +279,8 @@ class glpiPrinterCartridgesEdit extends plugin Assign name ... to smarty, if set */ if(isset($users[$this->tech_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->tech_num])); + $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index cca139717..d2ce0167e 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -77,7 +77,7 @@ class printgeneric extends plugin /* set orig dn to new if object is new */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if(!$ldap->count()){ $this->orig_dn = "new"; } @@ -206,9 +206,9 @@ class printgeneric extends plugin /* Detect if this is a valid printer account; */ + //FIXME: do we need to do this? we've already everything we need in $this->attrs... $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('objectClass')); if($ldap->count()){ $attrs = $ldap->fetch(); @@ -533,7 +533,7 @@ class printgeneric extends plugin /* Check if this dn points to a printer, to avoid deleting something else */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if(!$ldap->count()){ print_red("Trying to remove printer obejct which isn't a printer. Aborted to avoid data loss."); return; diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index a54546ec8..f2864d790 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -301,7 +301,7 @@ class servdns extends plugin */ foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); - $ldap->cat($dn); + $ldap->cat($dn, array('dn')); if(count($ldap->fetch())){ $ldap->cd($dn); $ldap->modify ($attrs); diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index bf510a9bb..fc4d86ff8 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -323,7 +323,7 @@ class servDNSeditZoneEntries extends plugin */ foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); - $ldap->cat($dn); + $ldap->cat($dn, array('dn')); if(count($ldap->fetch())){ $ldap->cd($dn); $ldap->modify ($attrs); diff --git a/plugins/admin/systems/class_servKolab.inc b/plugins/admin/systems/class_servKolab.inc index ba733edf5..d8359c056 100644 --- a/plugins/admin/systems/class_servKolab.inc +++ b/plugins/admin/systems/class_servKolab.inc @@ -289,7 +289,7 @@ $ldap->modify ($attrs); plugin::save(); /* Save or modify? */ - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if (!$ldap->fetch()){ $mode= "add"; } else { diff --git a/plugins/admin/systems/class_servNfs.inc b/plugins/admin/systems/class_servNfs.inc index 9e339ca31..6066a4f77 100644 --- a/plugins/admin/systems/class_servNfs.inc +++ b/plugins/admin/systems/class_servNfs.inc @@ -136,7 +136,7 @@ class servnfs extends plugin } } $ldap = $this->config->get_ldap_link(); - $ldap->cat($mountdn); + $ldap->cat($mountdn, array('dn')); $attrs = $ldap->fetch(); if (count($attrs) > 0) { $smarty->assign("mount_checked", "checked"); diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index ddb27e1ab..c3247fb09 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -285,12 +285,12 @@ class servrepository extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->config->current['BASE']); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if($ldap->count()){ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } @@ -341,7 +341,7 @@ $ldap->modify ($this->attrs); $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->config->current['BASE']); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if($ldap->count()){ $ldap->cd($this->dn); diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc index afc35e42b..15432a674 100644 --- a/plugins/admin/systems/class_servService.inc +++ b/plugins/admin/systems/class_servService.inc @@ -398,7 +398,7 @@ class servservice extends plugin # load data from mounts container $ldap = $this->config->get_ldap_link(); - $ldap->cat($mountsdn); + $ldap->cat($mountsdn, array('dn')); $attrs = $ldap->fetch(); # mounts container not present yet, so we create it @@ -409,31 +409,31 @@ class servservice extends plugin gosa_log("Mount container '$mountsdn' has been created"); } - # remove deleted mounts from the container - foreach ($this->mounts_to_remove as $entry) { - $mount=$this->returnMountEntry($entry); + # remove deleted mounts from the container + foreach ($this->mounts_to_remove as $entry) { + $mount=$this->returnMountEntry($entry); $mountdn = "cn=".$mount["cn"].","."$mountsdn"; - - $ldap->cat($mountdn); - $attrs = $ldap->fetch(); - - if (count($attrs) != 0) { - $ldap->rmdir($mountdn); - show_ldap_error($ldap->get_error()); - gosa_log("Mount object '".$mountdn."' has been removed"); - } - } - # add new mounts to the container - foreach ($this->mounts_to_add as $entry) { - + $ldap->cat($mountdn, array('dn')); + $attrs = $ldap->fetch(); + + if (count($attrs) != 0) { + $ldap->rmdir($mountdn); + show_ldap_error($ldap->get_error()); + gosa_log("Mount object '".$mountdn."' has been removed"); + } + } + + # add new mounts to the container + foreach ($this->mounts_to_add as $entry) { + $mount=$this->returnMountEntry($entry); $mountdn = "cn=".$mount["cn"].","."$mountsdn"; - $ldap->cd($mountdn); - $ldap->add($mount); - show_ldap_error($ldap->get_error()); - gosa_log("Mount object '".$mountdn."' has been added"); - } + $ldap->cd($mountdn); + $ldap->add($mount); + show_ldap_error($ldap->get_error()); + gosa_log("Mount object '".$mountdn."' has been added"); + } } function get_share_type($share) { diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index f5b14ce3f..5a6ba6fce 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -180,7 +180,7 @@ class systems extends plugin /* Find out more about the object type */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('objectClass')); $attrs= $ldap->fetch(); $type= $this->get_system_type($attrs['objectClass']); @@ -327,7 +327,7 @@ class systems extends plugin /* Find out more about the object type */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('objectClass')); $attrs= $ldap->fetch(); $type= $this->get_system_type($attrs['objectClass']); @@ -420,7 +420,7 @@ class systems extends plugin $ldap = $this->config->get_ldap_link(); } $ldap->cd ($this->dn); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if(count($ldap->fetch())){ $ldap->cd($this->dn); $ldap->rmDir($this->dn); diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index f7957f025..d282fe08a 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -398,7 +398,7 @@ class termDNS extends plugin */ foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); - $ldap->cat($dn); + $ldap->cat($dn, array('dn')); if(count($ldap->fetch())){ $ldap->cd($dn); $ldap->modify ($attrs); diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index c3a227a32..ae91f5f28 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -259,7 +259,7 @@ class termgeneric extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); if($ldap->count()){ $this->netConfigDNS->remove_from_parent(); $ldap->rmDir($this->dn); diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index f893dd0f6..bb173ae29 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -289,7 +289,7 @@ class termstartup extends plugin $tmp= preg_replace ("/^[^,]+,/", "", $tmp); $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp". - $this->config->current['BASE']); + $this->config->current['BASE'], array('gotoTerminalPath')); $attrs= $ldap->fetch(); if (isset($attrs['gotoTerminalPath'])){ $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index cd2ba4feb..1cf3899b0 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -824,7 +824,7 @@ class workstartup extends plugin $tmp= preg_replace ("/^[^,]+,/", "", $tmp); $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp". - $this->config->current['BASE']); + $this->config->current['BASE'], array('gotoTerminalPath')); $attrs= $ldap->fetch(); if (isset($attrs['gotoTerminalPath'])){ $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0]; diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 43360391a..828f5cf0d 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -292,9 +292,11 @@ class userManagement extends plugin $config= $this->config; $ldap_ui= $this->config->get_ldap_link(); if(isset($this->usertab->dn)){ - $user = ($ldap_ui->fetch($ldap_ui->cat($this->usertab->dn))); + $ldap_ui->cat($this->usertab->dn, array('uid')); + $user = $ldap_ui->fetch(); }else{ - $user = ($ldap_ui->fetch($ldap_ui->cat($this->dn))); + $ldap_ui->cat($this->dn, array('uid')); + $user = $ldap_ui->fetch(); } if((is_array($user))&&(isset($user['uid']))){ $username= $user['uid'][0]; diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index 0a713a327..cae6f0d63 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -603,7 +603,7 @@ class blocklist extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->base); $ldap->search("cn=$this->cn",array("cn")); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); if (count($a)){ diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 7da0510bc..0cc291709 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -467,12 +467,12 @@ class conference extends plugin $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); $ldap->cd($this->dn); if (count($a)){ $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events('modify'); } else { diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index 4f481ff19..3dc7eb390 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -357,8 +357,8 @@ class phoneConferenceManagment extends plugin } $ldap= $this->config->get_ldap_link(); - $ldap->cd ($conference['goFonConferenceOwner'][0]); - $data = $ldap->fetch($ldap->cat($conference['goFonConferenceOwner'][0])); + $ldap->cat($conference['goFonConferenceOwner'][0], array('cn')); + $data = $ldap->fetch(); $cn = $data['cn'][0]; $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => "style='text-align:center;width:20px;'"); diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 0e0d556c8..1f316f50f 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -400,7 +400,7 @@ class macro extends plugin /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); if(isset($this->orig_cn)){ diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc index f5a762f94..a167eacbc 100755 --- a/plugins/gofon/macro/class_gofonMacroParameters.inc +++ b/plugins/gofon/macro/class_gofonMacroParameters.inc @@ -374,7 +374,7 @@ class macroParameter extends plugin /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('dn')); $a= $ldap->fetch(); if (count($a)){ diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index 14cf03c42..6aa840bec 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -915,7 +915,6 @@ $ldap->modify ($attr); * to the new configured printers. */ foreach($this->gotoPrinter as $printer) { - $ldap->cd($printer['dn']); $ldap->cat($printer['dn']); $attrs= $ldap->fetch(); $attrs_used = array(); @@ -1034,7 +1033,7 @@ $ldap->modify ($attrs); } } - $ldap->cat ($this->dn); + $ldap->cat ($this->dn, array('dn')); if ($ldap->fetch()){ $mode= "modify"; } else { diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index e7872c67f..e47078544 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -808,7 +808,7 @@ class user extends plugin /* Save data. Using 'modify' implies that the entry is already present, use 'add' for new entries. So do a check first... */ - $ldap->cat ($this->dn); + $ldap->cat ($this->dn, array('dn')); if ($ldap->fetch()){ $mode= "modify"; } else { diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 55c127eb7..c61d6252f 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -950,7 +950,7 @@ $ldap->modify ($this->attrs); /* Walk through groups and add the descriptive entry if not exists */ foreach ($groups as $value){ if (!array_key_exists($value, $this->groupMembership)){ - $ldap->cat($value); + $ldap->cat($value, array('cn', 'description', 'dn')); $attrs= $ldap->fetch(); error_reporting (0); if (!isset($attrs['description'][0])){ @@ -960,7 +960,7 @@ $ldap->modify ($this->attrs); $entry= $attrs["cn"][0]." [$dsc]"; } error_reporting (E_ALL); - $this->groupMembership[$ldap->getDN()]= $entry; + $this->groupMembership[$attrs['dn']]= $entry; } } diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc index 116cb4062..e2335cca2 100644 --- a/plugins/personal/samba/class_sambaAccount.inc +++ b/plugins/personal/samba/class_sambaAccount.inc @@ -824,7 +824,7 @@ $ldap->modify ($this->attrs); { /* Load uid and gid of this 'dn' */ $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn); + $ldap->cat($this->dn, array('uidNumber', 'gidNumber')); $tmp= $ldap->fetch(); $this->uidNumber= $tmp['uidNumber'][0]; $this->gidNumber= $tmp['gidNumber'][0];