Code

Fixed problem with DNS Plugin
[gosa.git] / gosa-plugins / systems / admin / systems / class_termDNS.inc
index 62d6f6890ad2869ddc9922669a66e36c3a4ba5fd..e08e9afddb7c0dde791fc1c558a1654b362fd9e8 100644 (file)
@@ -156,9 +156,10 @@ class termDNS extends plugin
        */
       $this->dnsEntry     = DNS::getDNSHostEntries($config,$this->OrigCn);
 
+      $ptr = DNS::FlipIp($this->get_pTRRecord());
+
       /* Remove A record which equals $this->ipHostNumber
        */
-      $ptr = $this->get_pTRRecord();
       foreach($this->dnsEntry['RECORDS'] as $key => $rec){
         if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
           unset($this->dnsEntry['RECORDS'][$key]);
@@ -750,6 +751,15 @@ class termDNS extends plugin
         if(count($this->dhcpHostEntry['dhcpOption']) == 0){
           $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
         }
+      }else{
+
+        // Updated Host-Name entry 
+        foreach($this->dhcpHostEntry['dhcpOption'] as $key => $entry){
+          if(preg_match("/^host-name/", $entry)){
+            $this->dhcpHostEntry['dhcpOption'][$key] = "host-name ".$this->cn;
+            break;
+          }
+        }
       }
 
       /* Write mac address to dhcp settings */