summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e13a158)
raw | patch | inline | side by side (parent: e13a158)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Aug 2007 08:57:02 +0000 (08:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 28 Aug 2007 08:57:02 +0000 (08:57 +0000) |
-Dhcp client, list of available nodes will display all nodes now.
-Dhcp service, can be created on a new server now.
-Dhcp service, can be renamend without losing dhcp config.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7152 594d385d-05f5-0310-b6e9-bd551577e9d8
-Dhcp service, can be created on a new server now.
-Dhcp service, can be renamend without losing dhcp config.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7152 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servDHCP.inc | patch | blob | history | |
plugins/admin/systems/class_termDNS.inc | patch | blob | history |
index 60436ef0314820490765d1de127c46fc8e04d833..6538952b1e1840ecf26a676013b46b498c10dc94 100644 (file)
var $quote_option = array("domain-name");
+ var $orig_dn = "";
+
function servdhcp ($config, $dn= NULL, $parent= NULL)
{
plugin::plugin ($config, $dn, $parent);
$this->serviceDN = "cn=dhcp,".$dn;
+ $this->orig_dn = $dn;
$this->types= array( "dhcpLog" => _("Logging"),
"dhcpService" => _("Global options"),
foreach ($this->dhcpObjectCache as $dn => $data){
+ if($this->dn != $this->orig_dn){
+ $dn = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$dn);
+ }
+
/* Remove entry? */
if (count($data) == 0){
/* Check if exists, then remove... */
}
/* Modify existing entry? */
- if (isset($data['MODIFIED'])){
+ if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
if($ldap->cat($dn)){
$modify= TRUE;
if ($attribute == "MODIFIED" || $attribute == "dn"){
continue;
}
+
+ if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
+ foreach($values as $v_key => $value){
+ $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
+ }
+ }
+
if (count($values)){
-
- if($attribute == "dhcpOption"){
- foreach($values as $key => $value){
- $option_name = trim(preg_replace("/[^ ]*$/","",$value));
- $option_value= trim(preg_replace("/^[^ ]*/","",$value));
- if(in_array($option_name,$this->quote_option)){
- $values[$key] = $option_name." \"".$option_value."\"";
- }
- }
- }
+
+ if($attribute == "dhcpOption"){
+ foreach($values as $key => $value){
+ $option_name = trim(preg_replace("/[^ ]*$/","",$value));
+ $option_value= trim(preg_replace("/^[^ ]*/","",$value));
+ if(in_array($option_name,$this->quote_option)){
+ $values[$key] = $option_name." \"".$option_value."\"";
+ }
+ }
+ }
if (count($values) == 1){
$attrs[$attribute]= $values[0];
} else {
}
/* Self modify and place service dn entry */
- $this->dhcpServiceDN= $this->serviceDN;
+ $this->dhcpServiceDN= $this->dn;
+
plugin::save();
/* Save data to LDAP */
}
$sattrs['dn']= $ldap->getDN();
- foreach($sattrs as $name => $values){
- if($name == "dhcpOption"){
- foreach($values as $key => $value){
- $value_name = trim(preg_replace("/[^ ]*$/","",$value));
- $value_value= trim(preg_replace("/^[^ ]*/","",$value));
- if(in_array($value_name,$this->quote_option)){
- $value_value = preg_replace("/^\"/","",$value_value);
- $value_value = preg_replace("/\"$/","",$value_value);
- $sattrs[$name][$key] = $value_name." ".$value_value;
- }
- }
- }
- }
+ foreach($sattrs as $name => $values){
+ if($name == "dhcpOption"){
+ foreach($values as $key => $value){
+ $value_name = trim(preg_replace("/[^ ]*$/","",$value));
+ $value_value= trim(preg_replace("/^[^ ]*/","",$value));
+ if(in_array($value_name,$this->quote_option)){
+ $value_value = preg_replace("/^\"/","",$value_value);
+ $value_value = preg_replace("/\"$/","",$value_value);
+ $sattrs[$name][$key] = $value_name." ".$value_value;
+ }
+ }
+ }
+ }
$this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
$tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
index a0f2fd187573796a9db8b75a26a76cb4a98147a4..da1d331b61128193055248b5261ceaab70b58cb9 100644 (file)
while($attr = $ldap->fetch()){
$dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
}
-
+
foreach($dhcp_dns as $key => $pri_dns){
$ldap->cat($pri_dns,array("cn"));
$tmp = $ldap->fetch();
- $dhcp_dns[$key] = $tmp['cn'][0];
+ if(isset($tmp['cn'][0])){
+ $dhcp_dns[$key] = $tmp['cn'][0];
+ }else{
+ unset($dhcp_dns[$key]);
+ }
}
-
+
+ $tmp = $tmp2 = array();
foreach($dhcp_dns as $dn => $cn){
$ldap->cd($dn);
$ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
"(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
- $tmp = array();
while($attr = $ldap->fetch()){
$tmp[$attr['dn']] = $attr['cn'][0];
}
- $tmp2 = $this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.") ");
+ $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.") "));
}
return($tmp2);
}