Code

- modified a set of ldap->cat
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 10:03:39 +0000 (10:03 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 10:03:39 +0000 (10:03 +0000)
- 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

43 files changed:
TODO
html/getFAIscript.php
html/index.php
include/class_ldap.inc
include/class_password-methods.inc
include/class_plugin.inc
include/class_userinfo.inc
include/functions.inc
plugins/addons/addressbook/class_addressbook.inc
plugins/admin/applications/class_applicationGeneric.inc
plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/fai/class_faiManagement.inc
plugins/admin/fai/class_faiPackage.inc
plugins/admin/fai/class_faiSummaryTab.inc
plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupGeneric.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_termgroup.inc
plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_glpiPrinterAccount.inc
plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc
plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/class_servDNSeditZoneEntries.inc
plugins/admin/systems/class_servKolab.inc
plugins/admin/systems/class_servNfs.inc
plugins/admin/systems/class_servRepository.inc
plugins/admin/systems/class_servService.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_terminalStartup.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/users/class_userManagement.inc
plugins/gofax/blocklists/class_blocklistManagement.inc
plugins/gofon/conference/class_phoneConferenceGeneric.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc
plugins/gofon/macro/class_gofonMacro.inc
plugins/gofon/macro/class_gofonMacroParameters.inc
plugins/personal/environment/class_environment.inc
plugins/personal/generic/class_user.inc
plugins/personal/posix/class_posixAccount.inc
plugins/personal/samba/class_sambaAccount.inc

diff --git a/TODO b/TODO
index 4e09567845fe74eb793dcfca2d65fe6d285f5df8..3a7cfd1d22675480423a66309f5048bd604e5f90 100644 (file)
--- 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:
index e86bdcc78277a4f5bd777807aa3d7682eaf665a6..b22451a6798c965b3ed895b88a283276245d07e7 100644 (file)
@@ -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");
index e1baef37cb86bb383a54fbf4c56965ec1a72ae56..dd9cc28b93083f42e60d47178d1b551312cf901e 100644 (file)
@@ -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']);
index f8546bdf777bea71d35d447d2b44e66b2ec22d1a..94ae4c9244c550832c26e33ae3a45fb2dd118cd5 100644 (file)
@@ -267,6 +267,7 @@ class LDAP{
 
   function fetch()
   {
+    $att= array();
     if($this->hascon){
       if($this->hasres){
         if ($this->start == 0)
index c0ffba2b673fa44bdf3889d204122204e05679cd..97571da7900f3e6d51f3190319cc0ba9508d6e64 100644 (file)
@@ -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 
index c769b8fc32a7a9e52ba2c2901928c293c50ad7de..bab07709a5bb257c505272a0d67e806e3fb93fb8 100644 (file)
@@ -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<br>";
@@ -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<br>";
index 79e9526793437484a4699054ac3248f1a205e749..5ac469a8434828c5e447cc63276c437259928507 100644 (file)
@@ -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])){
index 94ec5b80d440f8a8fa7bc59938e4d06681c6c055..0bedbcee828d14132802645e0bcddf07024a8a0d 100644 (file)
@@ -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;
index 63415e90ecdc2bc1f8870dde112bcc9afca502e2..0f71b2eac18e89dbc61a36135e29eb30ba2bd506 100644 (file)
@@ -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 {
index da52cb304ad45e052debdf21e503bc5bcdbb950e..c50184cf9e41f351de38a9824c20a8ca43b372f2 100644 (file)
@@ -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)){
index 6d0343adee3c9f16bab1eb62c7ded13d378cdd8d..5086303fc72976bd9042fbe64c4708007b93c9b0 100644 (file)
@@ -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);
index 3f1be86de5082e1b58b6595dd2998633c43c290b..7bf6e75bd298d697f725a9cba71bf7e83cd22bc7 100644 (file)
@@ -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);                      
index 70d2096d4fbeb2e4abb5911e97fc7d9afdfbb176..43ca39a03b2f0a0bcdabaa2e4e59a24b75a7743c 100644 (file)
@@ -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);
index fbe589efd0eac078ad5af5d7389404f8947aebf1..c018ea8f36246b47d54a9132ac494a70374391e6 100644 (file)
@@ -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];
index b7e18d58a5de80ee2d0f2aa584c4af45b87510d3..c7f5b7b6de12759db76293dc0e9ba355d5fe77cf 100644 (file)
@@ -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"));
-
         }
 
 
index 61a63131439c63402c0361fbb53458343999457d..5d32a551b7f14ccb78b1fe012eb926907bac5774 100644 (file)
@@ -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)){
index 81afff4e310d2e66395062b99044d229b509355e..6e6004fbaf51f6a240371e37d87fed4e99615d53 100644 (file)
@@ -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)){
index b33232e1ffb47d198e7a5045ae650e8fe8fa3233..7d68d846d7de22a1a49651a1de3a7d42905eedd2 100644 (file)
@@ -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']) ||
index 0f8733c95fc264f5fb6b15c8577578215151bb5f..1ea5cab2ca06c1c369fd89da63aae805b7b730b0 100644 (file)
@@ -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]." ";             }
index 4ee03e31ab7069c4b318b61ca5d43537205b99e1..ea5a02ef6dad8c7279181bdcf4351a09dda00e71 100644 (file)
@@ -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]." ";             }
index c43a3f1124eaeda32136fd894571c1aea31613a9..7830396edc3ec3ed56ed6fcea95ad24d39ec950c 100644 (file)
@@ -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]." ";             }
index cca13971748924c67cea1ece5cf1515d1b2505b2..d2ce0167e707102fd103d87301c557d459f7bd00 100644 (file)
@@ -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;
index a54546ec89bc798e29a714b57ec10689ffeeda6a..f2864d790c5eefa317cd4d84e10dc84313185b0d 100644 (file)
@@ -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);
index bf510a9bb733fb48969aa1cc6dac53bd4fb7fa08..fc4d86ff83faa52fd81813ac7d8fd6face368420 100644 (file)
@@ -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);
index ba733edf5a42eeda429aad425f1f01e52b0a1e5d..d8359c056f296763ad46f2b36351614e45cdaf54 100644 (file)
@@ -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 {
index 9e339ca318222004415ba31087a6535a91d02281..6066a4f775eeb4412d564b6ab7a55c0d01d5d12d 100644 (file)
@@ -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");
index ddb27e1abc29e6e9ec0f5014ee579561e0d64179..c3247fb09fd249f1df40af8fabd263f169c56187 100644 (file)
@@ -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);
index afc35e42b5e5d2e4c2db9be4209a05db3d7d15e6..15432a67467fc6245a471dfe3cb852973f896706 100644 (file)
@@ -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) {
index f5b14ce3fcd1524cc234b70099652ac8dbc729da..5a6ba6fce7283e8106c3f0fe18ee79669b52acab 100644 (file)
@@ -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);
index f7957f0259eede707d40d07fea5886ac701fd86b..d282fe08a0aab6e92258bd20643e4e252ca97b9a 100644 (file)
@@ -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); 
index c3a227a3297eb0725f571e1540a3ffe1dfaad21a..ae91f5f28d947c19aa93ac9224631a8e9a62f66b 100644 (file)
@@ -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);
index f893dd0f6133adf38363b82608952dfe525dfc1b..bb173ae29b01369a540489c7e037b37c0230b7a0 100644 (file)
@@ -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];
index cd2ba4feb0a9cc5ceb0cabf7517a75b6ce0ae421..1cf3899b0a97ba9c5c67a0b894cfa7fb8bcb297d 100644 (file)
@@ -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];
index 43360391a44ec0bcc51a3241eea914783ca53c31..828f5cf0dbb8e46e0db37a2f4c069e33e0be8819 100644 (file)
@@ -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];
index 0a713a327aa0d116f167c69c7a2465b78f0c9fa6..cae6f0d639823ed044f989169147c0a9be8cdcfb 100644 (file)
@@ -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)){
index 7da0510bc4e21df634819ce0f384a68d3f1e512f..0cc2917090b2b4e9f780d8c528e0f83729954c42 100644 (file)
@@ -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 {
index 4f481ff19351cafe8d75cc7b0c591e0afb911ef7..3dc7eb390c13b884f80a6b722fe24301d730a2de 100644 (file)
@@ -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;'");
index 0e0d556c81f3f47e335054b22cafaa9836db1795..1f316f50f376e1eadac7df780c32fedb317c8a6b 100755 (executable)
@@ -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)){
index f5a762f940842f0be12b37fadabc8e066d0963c4..a167eacbc919fe9d773da07cc56cb0d0be634a7b 100755 (executable)
@@ -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)){
index 14cf03c420f6e0219e150eca2b22184aa9172d05..6aa840bec5e5811f5c443f0417d38e2ba7580640 100644 (file)
@@ -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 {
index e7872c67f801757e6b5647242b75595ef37b5f53..e47078544a44f8fd8862f1af2fbdc18658323602 100644 (file)
@@ -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 {
index 55c127eb7b01a3da91d93bd260cc7f19e8999c82..c61d6252f2bc300635d95d031edc7b39d9bb2e9e 100644 (file)
@@ -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;
       }
     }
 
index 116cb40626a2a444305ec1c498118d03c628c246..e2335cca23675ddfdf9f231b88a120208d15ee63 100644 (file)
@@ -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];