From 7d94653c63f1fdf372d4a225060d9652c62e11b9 Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 10 Mar 2008 12:00:53 +0000 Subject: [PATCH] Added ldapMultiplexer git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9555 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_config.inc | 3 +- gosa-core/include/class_ldap.inc | 153 ++++++++++-------- gosa-core/include/class_ldapMultiplexer.inc | 70 ++++++++ gosa-core/include/class_plugin.inc | 12 +- gosa-core/include/functions.inc | 32 ++-- .../plugins/admin/ogroups/class_ogroup.inc | 2 +- .../personal/password/class_password.inc | 2 +- .../personal/posix/class_posixAccount.inc | 2 +- 8 files changed, 180 insertions(+), 96 deletions(-) create mode 100644 gosa-core/include/class_ldapMultiplexer.inc diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 963db36b3..e8c58cacb 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -247,7 +247,8 @@ class config { $this->ldap->referrals= $this->current['REFERRAL']; } } - return ($this->ldap); + + return new ldapMultiplexer($this->ldap); } function set_current($name) diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index 742315ad3..560f809cf 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -31,13 +31,15 @@ define("SPECIALS_OVERRIDE", TRUE); class LDAP{ var $hascon =false; - var $hasres =false; var $reconnect=false; var $tls = false; - var $basedn =""; var $cid; + var $hasres = array(); + var $sr = array(); + var $basedn =""; + var $start = array(); // 0 if we are fetching the first entry, otherwise 1 var $error = ""; // Any error messages to be returned can be put here - var $start = 0; // 0 if we are fetching the first entry, otherwise 1 + var $srp = 0; var $objectClasses = array(); // Information read from slapd.oc.conf var $binddn = ""; var $bindpw = ""; @@ -68,6 +70,15 @@ class LDAP{ } + function getSearchResource() + { + $this->sr[$this->srp]= NULL; + $this->start[$this->srp]= 0; + $this->hasres[$this->srp]= false; + return $this->srp++; + } + + /* Function to replace all problematic characters inside a DN by \001XX, where \001 is decoded to chr(1) [ctrl+a]. It is not impossible, but very unlikely that this character is inside a DN. @@ -185,33 +196,35 @@ class LDAP{ function cd($dir) { - if ($dir == "..") + if ($dir == ".."){ $this->basedn = $this->getParentDir(); - else + } else { $this->basedn = LDAP::convert($dir); + } } function getParentDir($basedn = "") { - if ($basedn=="") + if ($basedn==""){ $basedn = $this->basedn; - else + } else { $basedn = LDAP::convert($this->basedn); + } return(ereg_replace("[^,]*[,]*[ ]*(.*)", "\\1", $basedn)); } - function search($filter, $attrs= array()) + function search($srp, $filter, $attrs= array()) { if($this->hascon){ if ($this->reconnect) $this->connect(); $start = microtime(); - $this->clearResult(); - $this->sr = @ldap_search($this->cid, LDAP::fix($this->basedn), $filter, $attrs); + $this->clearResult($srp); + $this->sr[$srp] = @ldap_search($this->cid, LDAP::fix($this->basedn), $filter, $attrs); $this->error = @ldap_error($this->cid); - $this->resetResult(); - $this->hasres=true; + $this->resetResult($srp); + $this->hasres[$srp]=true; /* Check if query took longer as specified in max_ldap_query_time */ if($this->max_ldap_query_time){ @@ -222,29 +235,29 @@ class LDAP{ } $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=search('".LDAP::fix($this->basedn)."', '$filter')"); - return($this->sr); + return($this->sr[$srp]); }else{ $this->error = "Could not connect to LDAP server"; return(""); } } - function ls($filter = "(objectclass=*)", $basedn = "",$attrs = array("*")) + function ls($srp, $filter = "(objectclass=*)", $basedn = "",$attrs = array("*")) { if($this->hascon){ if ($this->reconnect) $this->connect(); - $this->clearResult(); + $this->clearResult($srp); if ($basedn == "") $basedn = $this->basedn; else $basedn= LDAP::convert($basedn); $start = microtime(); - $this->sr = @ldap_list($this->cid, LDAP::fix($basedn), $filter,$attrs); + $this->sr[$srp] = @ldap_list($this->cid, LDAP::fix($basedn), $filter,$attrs); $this->error = @ldap_error($this->cid); - $this->resetResult(); - $this->hasres=true; + $this->resetResult($srp); + $this->hasres[$srp]=true; /* Check if query took longer as specified in max_ldap_query_time */ if($this->max_ldap_query_time){ @@ -256,25 +269,25 @@ class LDAP{ $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=ls('".LDAP::fix($basedn)."', '$filter')"); - return($this->sr); + return($this->sr[$srp]); }else{ $this->error = "Could not connect to LDAP server"; return(""); } } - function cat($dn,$attrs= array("*")) + function cat($srp, $dn,$attrs= array("*")) { if($this->hascon){ if ($this->reconnect) $this->connect(); - $this->clearResult(); + $this->clearResult($srp); $filter = "(objectclass=*)"; - $this->sr = @ldap_read($this->cid, LDAP::fix($dn), $filter,$attrs); + $this->sr[$srp] = @ldap_read($this->cid, LDAP::fix($dn), $filter,$attrs); $this->error = @ldap_error($this->cid); - $this->resetResult(); - $this->hasres=true; - return($this->sr); + $this->resetResult($srp); + $this->hasres[$srp]=true; + return($this->sr[$srp]); }else{ $this->error = "Could not connect to LDAP server"; return(""); @@ -294,16 +307,16 @@ class LDAP{ } } - function fetch() + function fetch($srp) { $att= array(); if($this->hascon){ - if($this->hasres){ - if ($this->start == 0) + if($this->hasres[$srp]){ + if ($this->start[$srp] == 0) { - if ($this->sr){ - $this->start = 1; - $this->re= @ldap_first_entry($this->cid, $this->sr); + if ($this->sr[$srp]){ + $this->start[$srp] = 1; + $this->re= @ldap_first_entry($this->cid, $this->sr[$srp]); } else { return array(); } @@ -321,7 +334,7 @@ class LDAP{ } return($att); }else{ - $this->error = "Perform a Fetch with no Search"; + $this->error = "Perform a fetch with no search"; return(""); } }else{ @@ -330,23 +343,23 @@ class LDAP{ } } - function resetResult() + function resetResult($srp) { - $this->start = 0; + $this->start[$srp] = 0; } - function clearResult() + function clearResult($srp) { - if($this->hasres){ - $this->hasres = false; - @ldap_free_result($this->sr); + if($this->hasres[$srp]){ + $this->hasres[$srp] = false; + @ldap_free_result($this->sr[$srp]); } } - function getDN() + function getDN($srp) { if($this->hascon){ - if($this->hasres){ + if($this->hasres[$srp]){ if(!$this->re) { @@ -369,11 +382,11 @@ class LDAP{ } } - function count() + function count($srp) { if($this->hascon){ - if($this->hasres){ - $rv = @ldap_count_entries($this->cid, $this->sr); + if($this->hasres[$srp]){ + $rv = @ldap_count_entries($this->cid, $this->sr[$srp]); $this->error = @ldap_error($this->cid); return($rv); }else{ @@ -440,16 +453,16 @@ class LDAP{ * */ - function rmdir_recursive($deletedn) + function rmdir_recursive($srp, $deletedn) { if($this->hascon){ if ($this->reconnect) $this->connect(); $delarray= array(); /* Get sorted list of dn's to delete */ - $this->ls ("(objectClass=*)",$deletedn); - while ($this->fetch()){ - $deldn= $this->getDN(); + $this->ls ($srp, "(objectClass=*)",$deletedn); + while ($this->fetch($srp)){ + $deldn= $this->getDN($srp); $delarray[$deldn]= strlen($deldn); } arsort ($delarray); @@ -457,7 +470,7 @@ class LDAP{ /* Really Delete ALL dn's in subtree */ foreach ($delarray as $key => $value){ - $this->rmdir_recursive($key); + $this->rmdir_recursive($srp, $key); } /* Finally Delete own Node */ @@ -500,7 +513,7 @@ class LDAP{ } } - function create_missing_trees($target) + function create_missing_trees($srp, $target) { global $config; @@ -536,8 +549,8 @@ class LDAP{ continue; } - $this->cat ($cdn); - $attrs= $this->fetch(); + $this->cat ($srp, $cdn); + $attrs= $this->fetch($srp); /* Create missing entry? */ if (count ($attrs)){ @@ -643,14 +656,14 @@ class LDAP{ } - function recursive_remove() + function recursive_remove($srp) { $delarray= array(); /* Get sorted list of dn's to delete */ - $this->search ("(objectClass=*)"); - while ($this->fetch()){ - $deldn= $this->getDN(); + $this->search ($srp, "(objectClass=*)"); + while ($this->fetch($srp)){ + $deldn= $this->getDN($srp); $delarray[$deldn]= strlen($deldn); } arsort ($delarray); @@ -737,22 +750,22 @@ class LDAP{ } - function gen_ldif ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE) + function gen_ldif ($srp, $dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE) { $display= ""; if ($recursive){ $this->cd($dn); - $this->ls($filter,$dn, array('dn','objectClass')); + $this->ls($srp, $filter,$dn, array('dn','objectClass')); $deps = array(); $display .= $this->gen_one_entry($dn)."\n"; - while ($attrs= $this->fetch()){ + while ($attrs= $this->fetch($srp)){ $deps[] = $attrs['dn']; } foreach($deps as $dn){ - $display .= $this->gen_ldif($dn, $filter,$attributes,$recursive); + $display .= $this->gen_ldif($srp, $dn, $filter,$attributes,$recursive); } } else { $display.= $this->gen_one_entry($dn); @@ -761,15 +774,15 @@ class LDAP{ } - function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE,$r_array=0) + function gen_xls ($srp, $dn, $filter= "(objectClass=*)", $attributes= array('*'), $recursive= TRUE,$r_array=0) { $display= array(); $this->cd($dn); - $this->search("$filter"); + $this->search($srp, "$filter"); $i=0; - while ($attrs= $this->fetch()){ + while ($attrs= $this->fetch($srp)){ $j=0; foreach ($attributes as $at){ @@ -849,7 +862,7 @@ class LDAP{ if JustMofify id false the destination dn will be overwritten by the new ldif. */ - function import_complete_ldif($str_attr,&$error,$JustModify,$DeleteOldEntries) + function import_complete_ldif($srp, $str_attr,&$error,$JustModify,$DeleteOldEntries) { if($this->reconnect) $this->connect(); @@ -960,7 +973,7 @@ class LDAP{ } /* If we can't Import, return with a file error */ - if(!$this->import_single_entry($single,$usemodify,$usermdir) ) { + if(!$this->import_single_entry($srp, $single,$usemodify,$usermdir) ) { $error= sprintf(_("Error while importing dn: '%s', please check your LDIF from line %s on!"), $line, $current_line); return UNKNOWN_TOKEN_IN_LDIF_FILE; } @@ -975,7 +988,7 @@ class LDAP{ if $modify is true; All variables that are not touched by the new ldif will be kept. if $modify is false; The new ldif overwrites the old entry, and all untouched attributes get lost. */ - function import_single_entry($str_attr,$modify,$delete) + function import_single_entry($srp, $str_attr,$modify,$delete) { global $config; @@ -1056,13 +1069,13 @@ class LDAP{ /* Delete existing entry */ if($delete){ - $this->rmdir_recursive($data['dn']); + $this->rmdir_recursive($srp, $data['dn']); } /* Create missing trees */ $this->cd ($this->basedn); $this->cd($config->current['BASE']); - $this->create_missing_trees(preg_replace("/^[^,]+,/","",$data['dn'])); + $this->create_missing_trees($srp, preg_replace("/^[^,]+,/","",$data['dn'])); $this->cd($data['dn']); $dn = $data['dn']; @@ -1070,11 +1083,11 @@ class LDAP{ if(!$modify){ - $this->cat($dn); - if($this->count()){ + $this->cat($srp, $dn); + if($this->count($srp)){ /* The destination entry exists, overwrite it with the new entry */ - $attrs = $this->fetch(); + $attrs = $this->fetch($srp); foreach($attrs as $name => $value ){ if(!is_numeric($name)){ if(in_array($name,array("dn","count"))) continue; diff --git a/gosa-core/include/class_ldapMultiplexer.inc b/gosa-core/include/class_ldapMultiplexer.inc new file mode 100644 index 000000000..8940952e1 --- /dev/null +++ b/gosa-core/include/class_ldapMultiplexer.inc @@ -0,0 +1,70 @@ +object= $object; + + /* Set result resource */ + $this->sr= $this->object->getSearchResource(); + } + + public function __call($methodName, $parameters) { + $id = md5($methodName.serialize($parameters)); + + /* Add resource pointer if the mentioned methods are used */ + if (preg_match('/^(search|ls|cat|fetch|clearResult|resetResult|count|getDN|recursive_remove|rmdir_recursive|gen_xls|gen_ldif|create_missing_trees|import_single_entry|import_complete_ldif)$/', $methodName)){ + array_unshift($parameters, $this->sr); + } + + try { + $class= new ReflectionClass($this->object); + $method= $class->getMethod($methodName); + + return $method->invokeArgs($this->object, $parameters); + } + + catch (ReflectionException $e) { + } + } + + + public function __get($memberName) { + echo "Obsolete access to member variable '$memberName'!
"; + return $this->object->$memberName; + } + +} + +?> diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 72f0f26ae..2bd31a5e3 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -803,7 +803,7 @@ class plugin $ldap->cd($dst_dn); $ldap->add($new); - if ($ldap->error != "Success"){ + if (!$ldap->success()){ trigger_error("Trying to save $dst_dn failed.", E_USER_WARNING); return(FALSE); @@ -868,7 +868,7 @@ class plugin /* Delete source */ $ldap= $this->config->get_ldap_link(); $ldap->rmdir_recursive($src_dn); - if ($ldap->error != "Success"){ + if (!$ldap->success()){ trigger_error("Trying to delete $src_dn failed.", E_USER_WARNING); return (FALSE); @@ -1071,7 +1071,7 @@ class plugin $password = $tmp['SNAPSHOT_PASSWORD']; $snapldapbase = $tmp['SNAPSHOT_BASE']; - $ldap_to = new LDAP($user,$password, $server); + $ldap_to = new ldapMultipelxer(new LDAP($user,$password, $server)); $ldap_to -> cd($snapldapbase); if (!$ldap_to->success()){ @@ -1202,7 +1202,7 @@ class plugin $password = $cfg['SNAPSHOT_PASSWORD']; $snapldapbase = $cfg['SNAPSHOT_BASE']; - $ldap_to = new LDAP($user,$password, $server); + $ldap_to = new ldapMultiplexer(new LDAP($user,$password, $server)); $ldap_to -> cd ($snapldapbase); if (!$ldap_to->success()){ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); @@ -1260,7 +1260,7 @@ class plugin $user = $cfg['SNAPSHOT_USER']; $password = $cfg['SNAPSHOT_PASSWORD']; $snapldapbase = $cfg['SNAPSHOT_BASE']; - $ldap_to = new LDAP($user,$password, $server); + $ldap_to = new ldapMultiplexer(new LDAP($user,$password, $server)); $ldap_to->cd ($snapldapbase); if (!$ldap_to->success()){ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); @@ -1326,7 +1326,7 @@ class plugin $user = $cfg['SNAPSHOT_USER']; $password = $cfg['SNAPSHOT_PASSWORD']; $snapldapbase = $cfg['SNAPSHOT_BASE']; - $ldap_to = new LDAP($user,$password, $server); + $ldap_to = new ldapMultiplexer(new LDAP($user,$password, $server)); $ldap_to->cd ($snapldapbase); if (!$ldap_to->success()){ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class())); diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index b843bc641..5ad63e34c 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -314,7 +314,7 @@ function ldap_init ($server, $base, $binddn='', $pass='') isset($config->current['TLS']) && $config->current['TLS'] == "true"); /* Sadly we've no proper return values here. Use the error message instead. */ - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ echo sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()); exit(); } @@ -340,7 +340,7 @@ function process_htaccess ($username, $kerberos= FALSE) /* Look for entry or realm */ $ldap= $config->get_ldap_link(); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), sprintf(_('User login failed.').'

'._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); $smarty= get_smarty(); $smarty->display(get_template_path('headers.tpl')); @@ -367,7 +367,7 @@ function ldap_login_user_htaccess ($username) /* Look for entry or realm */ $ldap= $config->get_ldap_link(); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), sprintf(_('User login failed.').'

'._('LDAP server returned: %s'), "

".$ldap->get_error().""), FATAL_ERROR_DIALOG); $smarty= get_smarty(); $smarty->display(get_template_path('headers.tpl')); @@ -405,8 +405,8 @@ function ldap_login_user ($username, $password) /* look through the entire ldap */ $ldap = $config->get_ldap_link(); - if (!preg_match("/Success/i", $ldap->error)){ - msg_dialog::display(_("LDAP error"), sprintf(_("User login failed.")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), FATAL_ERROR_DIALOG); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error()), FATAL_ERROR_DIALOG); $smarty= get_smarty(); $smarty->display(get_template_path('headers.tpl')); echo "".session::get('errors').""; @@ -474,7 +474,7 @@ function ldap_login_user ($username, $password) $config->current['RECURSIVE'] == "true", isset($config->current['TLS']) && $config->current['TLS'] == "true"); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ return (NULL); } @@ -601,7 +601,7 @@ function add_lock ($object, $user) $ldap->cd ($config->current['CONFIG']); $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64_encode($object)."))", array("gosaUser")); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("Configuration error"), sprintf(_("Cannot create locking information in LDAP tree. Please contact your administrator!")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); return; } @@ -616,7 +616,7 @@ function add_lock ($object, $user) $attrs["gosaObject"] = base64_encode($object); $attrs["cn"] = "$name"; $ldap->add($attrs); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("Internal error"), sprintf(_("Adding a lock failed.")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); return; } @@ -645,10 +645,10 @@ function del_lock ($object) $ldap->cd ($config->current['CONFIG']); $ldap->search ("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaObject")); $attrs= $ldap->fetch(); - if ($ldap->getDN() != "" && preg_match("/Success/i", $ldap->error)){ + if ($ldap->getDN() != "" && $ldap->success()){ $ldap->rmdir ($ldap->getDN()); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), sprintf(_("Removing a lock failed.")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); return; } @@ -687,7 +687,7 @@ function get_lock ($object) $ldap= $config->get_ldap_link(); $ldap->cd ($config->current['CONFIG']); $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser")); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), sprintf(_("Cannot get locking information from LDAP tree!")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); return(""); } @@ -732,7 +732,7 @@ function get_multiple_locks($objects) $ldap= $config->get_ldap_link(); $ldap->cd ($config->current['CONFIG']); $ldap->search($filter, array("gosaUser","gosaObject")); - if (!preg_match("/Success/i", $ldap->error)){ + if (!$ldap->success()){ msg_dialog::display(_("LDAP error"), sprintf(_("Cannot get locking information from LDAP tree!")."

"._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); return(""); } @@ -865,7 +865,7 @@ function get_sub_list($filter, $category,$sub_deps, $base= "", $attributes= arra } /* Check for size limit exceeded messages for GUI feedback */ - if (preg_match("/size limit/i", $ldap->error)){ + if (preg_match("/size limit/i", $ldap->get_error())){ session::set('limit_exceeded', TRUE); $limit_exceeded = TRUE; } @@ -934,7 +934,7 @@ function get_list($filter, $category, $base= "", $attributes= array(), $flags= G } /* Check for size limit exceeded messages for GUI feedback */ - if (preg_match("/size limit/i", $ldap->error)){ + if (preg_match("/size limit/i", $ldap->get_error())){ session::set('limit_exceeded', TRUE); } @@ -2238,7 +2238,7 @@ function check_schema($cfg,$rfc2307bis = FALSE) $messages= array(); /* Get objectclasses */ - $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']); + $ldap = new ldapMultiplexer(new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls'])); $objectclasses = $ldap->get_objectclasses(); if(count($objectclasses) == 0){ msg_dialog::display(_("LDAP warning"), _("Cannot get schema information from server. No schema check possible!"), WARNING_DIALOG); @@ -2540,7 +2540,7 @@ function change_password ($dn, $password, $mode=0, $hash= "") new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error()); - if ($ldap->error != 'Success') { + if (!$ldap->success()) { msg_dialog::display(_("LDAP error"), sprintf(_('Setting the password failed!').'

'._('LDAP server returned: %s'), "

".$ldap->get_error().""), ERROR_DIALOG); } else { diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index 92460840c..f15d1b378 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -466,7 +466,7 @@ class ogroup extends plugin $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass")); /* It has failed, add entry with type flag I (Invalid)*/ - if ($ldap->error != "Success"){ + if (!$ldap->success()){ $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I"); } else { diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc index 12e33d4d8..014908f75 100644 --- a/gosa-core/plugins/personal/password/class_password.inc +++ b/gosa-core/plugins/personal/password/class_password.inc @@ -104,7 +104,7 @@ class password extends plugin isset($this->config->current['TLS']) && preg_match("/true/i",$this->config->current['TLS'])); /* connection Successfull ? */ - if ($tldap->error != "Success"){ + if (!$tldap->success()){ msg_dialog::display(_("User password"), _("The password you've entered as your current password doesn't match the real one."),WARNING_DIALOG); }else{ diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index c50bf1f8e..1b54695c1 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -1348,7 +1348,7 @@ class posixAccount extends plugin $res= get_list($filter, "groups", $base,$attrs, $Flags); /* check sizelimit */ - if (preg_match("/size limit/i", $ldap->error)){ + if (preg_match("/size limit/i", $ldap->get_error())){ session::set('limit_exceeded',TRUE); } -- 2.30.2