index 6039a29bb9557f9090b251e64208bb1cd5ee833e..13c2956007036ade69e71bf3cef73de14f1d76d7 100644 (file)
var $dialog = NULL;
var $usedDNS = array();
+
+ var $orig_dn = "";
+
+ var $DNSinitially_was_account;
+
+
function servdns ($config, $dn= NULL)
{
plugin::plugin ($config, $dn);
+ $this->orig_dn = $dn;
+
/* All types with required attrs */
$this->RecordTypes['aRecord'] = "aRecord"; // ok
$this->RecordTypes['mDRecord'] = "mDRecord"; // ok
$this->RecordTypes['rRSIGRecord'] = "rRSIGRecord"; // ok
$this->RecordTypes['nSECRecord'] = "nSECRecord"; // ok
- $this->cn = $this->attrs['cn'][0];
$types = array();
/* Get all records */
$ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("*"));
while($attrs = $ldap->fetch()){
- /* If relative domainname == cn
+ /* If relative domainname
* Try to read dnsclass / TTl / zone
*/
$this->usedDNS[$attrs['dn']] = $attrs['dn'];
/* Remove dns service */
function remove_from_parent()
{
+ if(!$this->DNSinitially_was_account){
+ return;
+ }
+
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
foreach($this->usedDNS as $dn){
$ldap->cd($dn);
$ldap->rmdir_recursive($dn);
}
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->orig_dn);
+ $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=@))",array("relativeDomainName","zoneName"));
+ while($attr = $ldap->fetch()){
+ $ldap->cd($attr['dn']);
+ $ldap->rmDir($attr['dn']);
+ }
+
+
show_ldap_error($ldap->get_error());
}
}
}
}
-
+
/* Check if there are records removed,
if there are some removed records, the append an array
to ensure that these record types are deleted
*/
if((isset($zone['Records']))&&(is_array($zone['Records']))){
foreach($zone['Records'] as $type){
- if(isset($type['inittype'])){
+ if((isset($type['inittype']))&&($type['inittype']!="")){
if($type['type'] != $type['inittype']){
$tmp[$type['inittype']] = array();
}
}
}
}
+
/* generate forward entry */
$dn = "zoneName=".$zone['zoneName'].",".$this->dn;
$tmp2[$dn] = $tmp;