/usr/share/gosa/plugins/admin/systems/services/ldap/class_goLdapServer.inc is in gosa-plugin-goto 2.7.4+reloaded2-1+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | <?php
class goLdapServer extends goService{
var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
var $cli_description = "Some longer text\nfor help";
var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
/* This plugin only writes its objectClass */
var $objectclasses = array("goLdapServer");
var $attributes = array("goLdapBase");
var $StatusFlag = "goLdapServerStatus";
/* This class can't be assigned twice so it conflicts with itsself */
var $conflicts = array("goLdapServer");
var $DisplayName = "";
var $dn = NULL;
var $cn = "";
var $goLdapServerStatus = "";
var $goLdapBase = "";
var $oldBase = "";
var $view_logged =FALSE;
var $krb_service_prefix = "ldap/";
function goLdapServer(&$config,$dn)
{
goService::goService($config,$dn);
$this->DisplayName = _("LDAP service");
/* Suggest a default value */
if ($this->goLdapBase == ""){
if ($this->dn == ""){
$srv= _("enter your servers DNS name");
} else {
$srv= preg_replace("/^cn=([^,]+),.*$/", "$1", $this->dn);
}
$this->goLdapBase= "ldap://$srv:389/".$config->current['BASE'];
}
$this->oldBase = $this->goLdapBase;
}
function execute()
{
if($this->is_account && !$this->view_logged){
$this->view_logged = TRUE;
new log("view","server/".get_class($this),$this->dn);
}
$smarty = get_smarty();
foreach($this->attributes as $attr){
$smarty->assign($attr, set_post($this->$attr));
}
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translated){
$smarty->assign($name."ACL",$this->getacl($name));
}
return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
}
function getListEntry()
{
$fields = goService::getListEntry();
$fields['Message'] = _("LDAP service");
return($fields);
}
function check()
{
$message = plugin::check();
if(empty($this->goLdapBase)){
$message[] = msgPool::required(_("LDAP URI"));
}
if(!preg_match("/^ldap[si]?:\/\/[0-9a-z_.-]{1,}+(:[0-9]+)?\/.+$/i", $this->goLdapBase)){
$message[] = msgPool::invalid(_("LDAP URI"),"","","(ldap|ldaps|ldapi)://"._("Server")."(:"._("Port").")/"._("Base"));
}
return($message);
}
function save_object()
{
if(isset($_POST['goLdapServerPosted'])){
plugin::save_object();
}
}
function save()
{
goService::save();
/* Update object relation */
if(!empty($this->oldBase) && $this->oldBase != $this->goLdapBase){
$new = array();
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search('(&(objectClass=GOhard)(gotoLdapServer=*'.$this->oldBase.'))',array("cn","gotoLdapServer"));
while($attrs = $ldap->fetch()){
$ldapServer = array();
for($i = 0 ; $i < $attrs['gotoLdapServer']['count'] ; $i ++ ){
$ldapServer[] = preg_replace("/".preg_quote($this->oldBase, '/')."/",$this->goLdapBase,$attrs['gotoLdapServer'][$i]);
}
$new[$attrs['dn']]['gotoLdapServer'] = $ldapServer;
}
foreach($new as $dn => $data){
$ldap->cd($dn);
$ldap->modify($data);
if(!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
}
}
}
}
/* Return plugin informations for acl handling */
static function plInfo()
{
return (array(
"plShortName" => _("LDAP"),
"plDescription" => _("LDAP service").")",
"plSelfModify" => FALSE,
"plDepends" => array(),
"plPriority" => 96,
"plSection" => array("administration"),
"plCategory" => array("server"),
"plRequirements"=> array(
'ldapSchema' => array('goLdapServer' => '>=2.7'),
'onFailureDisablePlugin' => array(get_class())
),
"plProvidedAcls"=> array(
"start" => _("Start"),
"stop" => _("Stop"),
"restart" => _("Restart"),
"goLdapBase" => _("LDAP base"))
));
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
|