From 924f80ac5a0642c90c3e4574bef8ce85545048fc Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 28 Jan 2008 07:57:01 +0000 Subject: [PATCH] Updated socket client - Only try to encrypt if encryption is enabled. Removed some echos -From plugin.inc git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8612 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_plugin.inc | 22 ++++++---------------- gosa-core/include/class_socketClient.inc | 23 +++++++++++++++-------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 8eec579c4..06336cd2e 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -314,9 +314,6 @@ class plugin $data = ""; } $this->$val= $data; - //echo "".$val."
"; - }else{ - //echo "".$val."
"; } } } @@ -972,14 +969,11 @@ class plugin $tmp = $source[$var][$i]; } $this->$var = $tmp; -# echo $var."=".$tmp."
"; }else{ $this->$var = $source[$var][0]; -# echo $var."=".$source[$var][0]."
"; } }else{ $this->$var= $source[$var]; -# echo $var."=".$source[$var]."
"; } } } @@ -1514,12 +1508,12 @@ class plugin if(isset($this->base) && isset($this->config->idepartments[$this->base])){ $deps[$this->base] = $this->config->idepartments[$this->base]; }else{ - echo "No default base found. ".$this->base."
"; + trigger_error("No default base found in class ".get_class($this).". ".$this->base); } - return($deps); } + /* This function modifies object acls too, if an object is moved. * $old_dn specifies the actually used dn * $new_dn specifies the destiantion dn @@ -1597,14 +1591,10 @@ class plugin /* Acls for this object must be adjusted */ if($found){ - if($output_changes){ - echo "". - _("Changing ACL dn")." : 
 -"._("from")."  ". - $old_dn. - "
 -"._("to")." ". - $new_dn. - "

"; - } + $debug_info= _("Changing ACL dn")." : 
 -"._("from")."  ". + $old_dn."
 -"._("to")." ".$new_dn."
"; + @DEBUG (DEBUG_ACL, __LINE__, __FUNCTION__, __FILE__,$debug_info,"ACL"); + $update[$attrs['dn']] =array(); foreach($acls as $acl){ $update[$attrs['dn']]['gosaAclEntry'][] = $acl; diff --git a/gosa-core/include/class_socketClient.inc b/gosa-core/include/class_socketClient.inc index fd71b01f0..2812e2688 100644 --- a/gosa-core/include/class_socketClient.inc +++ b/gosa-core/include/class_socketClient.inc @@ -11,6 +11,7 @@ class Socket_Client private $handle = NULL; private $bytes_read = 0; private $error = ""; + private $b_encrypt = FALSE; /* Crypto information */ private $td= NULL; @@ -36,31 +37,37 @@ class Socket_Client if(!function_exists("mcrypt_get_iv_size")){ $this->error = _("The mcrypt module was not found. Please install php5-mcrypt."); $this->ckey = ""; - return FALSE ; + $this->b_encrypt = FALSE; } if ($this->connected()){ $this->ckey = substr(md5($key), 0, $this->ks); - return TRUE; + $this->b_encrypt = TRUE; } - return FALSE; + return($this->b_encrypt); } private function encrypt($data) { - mcrypt_generic_init($this->td, $this->ckey, $this->iv); - return base64_encode(mcrypt_generic($this->td, $data)); + if($this->b_encrypt){ + mcrypt_generic_init($this->td, $this->ckey, $this->iv); + $data = base64_encode(mcrypt_generic($this->td, $data)); + } + return($data); } private function decrypt($data) { /* decrypt data */ - $data = base64_decode($data); - mcrypt_generic_init($this->td, $this->ckey, $this->iv); - return mdecrypt_generic($this->td, $data); + if($this->b_encrypt){ + $data = base64_decode($data); + mcrypt_generic_init($this->td, $this->ckey, $this->iv); + $data = mdecrypt_generic($this->td, $data); + } + return($data); } -- 2.30.2