From: hickert Date: Mon, 24 Oct 2005 11:02:28 +0000 (+0000) Subject: Hook / Script -> FAIscript = binary X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9257a76b419aca878f2ebea8315455339b5a57e2;p=gosa.git Hook / Script -> FAIscript = binary git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1678 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 866d7698e..89f73d8fe 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -72,6 +72,7 @@ class faiHook extends plugin foreach($this->subAttributes as $attrs){ $this->SubObjects[$object['cn'][0]][$attrs]=addslashes($this->SubObjects[$object['cn'][0]][$attrs]); } + $this->SubObjects[$object['cn'][0]]['FAIscript'] = $this->readBinary("FAIscript",$object['dn']); } } } @@ -314,6 +315,38 @@ class faiHook extends plugin show_ldap_error($ldap->get_error()); } } + + function readBinary($attr,$dn){ + $Data =""; + $ds= ldap_connect($this->config->current['SERVER']); + ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") { + ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1); + ldap_set_rebind_proc($ds, array(&$this, "rebind")); + } + + if(isset($this->config->current['TLS']) && $this->config->current['TLS'] == "true"){ + ldap_start_tls($ds); + } + + $r = ldap_bind($ds); + $sr = @ldap_read($ds, $dn, $attr."=*", array($attr)); + + if ($sr) { + $ei=ldap_first_entry($ds, $sr); + if ($ei) { + if ($info = ldap_get_values_len($ds, $ei, $attr)){ + $Data= $info[0]; + } + } + } + + /* close conncetion */ + ldap_unbind($ds); + return($Data); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 92965bf5d..9885b5cfa 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -70,6 +70,8 @@ class faiScript extends plugin foreach($this->subAttributes as $attrs){ $this->SubObjects[$object['cn'][0]][$attrs]=addslashes($this->SubObjects[$object['cn'][0]][$attrs]); } + + $this->SubObjects[$object['cn'][0]]['FAIscript'] = $this->readBinary("FAIscript",$object['dn']); $this->SubObjects[$object['cn'][0]]['status'] = "edited"; $this->SubObjects[$object['cn'][0]]['dn'] = $object['dn']; @@ -311,6 +313,39 @@ class faiScript extends plugin show_ldap_error($ldap->get_error()); } } + + + function readBinary($attr,$dn){ + $Data =""; + $ds= ldap_connect($this->config->current['SERVER']); + ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") { + ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1); + ldap_set_rebind_proc($ds, array(&$this, "rebind")); + } + + if(isset($this->config->current['TLS']) && $this->config->current['TLS'] == "true"){ + ldap_start_tls($ds); + } + + $r = ldap_bind($ds); + $sr = @ldap_read($ds, $dn, $attr."=*", array($attr)); + + if ($sr) { + $ei=ldap_first_entry($ds, $sr); + if ($ei) { + if ($info = ldap_get_values_len($ds, $ei, $attr)){ + $Data= $info[0]; + } + } + } + + /* close conncetion */ + ldap_unbind($ds); + return($Data); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: