summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42c1582)
raw | patch | inline | side by side (parent: 42c1582)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 17 Jan 2007 06:49:51 +0000 (06:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 17 Jan 2007 06:49:51 +0000 (06:49 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5577 594d385d-05f5-0310-b6e9-bd551577e9d8
index 4754d822889330a454d624c3e329f075ebbe83da..b8346e26c19b82cf77fbb28a6e6dd51911765253 100644 (file)
function getDNSZoneEntries($config,$HostDn,$silent = false)
{
global $RecordTypes;
-
+
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
*/
$sOAREcords = array("0"=>"sOAprimary","1"=>"sOAmail","2"=>"sOAserial","3"=>"sOArefresh","4"=>"sOAretry","5"=>"sOAexpire","6"=>"sOAttl");
+ /* Get host entry */
+ $ldap->cat($HostDn);
+ $host_attr = $ldap->fetch();
+
/* Create tempalte for all fetched zone Data
*/
$ZoneBase = array();
*/
foreach($tmp_res as $attrs){
- $zoneName = $attrs['zoneName'][0];
+ $zoneName = strtoupper($host_attr['cn'][0])."/".$attrs['zoneName'][0];
$Zones[$zoneName] = $ZoneBase;
$Zones[$zoneName]['exists'] = true;
/* Set basic attributes
*/
- foreach(array("zoneName","dNSClass") as $attr){
- if(isset($attrs[$attr][0])){
- $Zones[$zoneName][$attr] = $attrs[$attr][0];
- }
+ if(isset($attrs["dNSClass"][0])){
+ $Zones[$zoneName]["dNSClass"] = $attrs["dNSClass"][0];
}
/* Set initial zone name, to be able to detect if this entry was renamed
*/
$Zones[$zoneName]['InitialzoneName'] = $zoneName;
+ $Zones[$zoneName]['zoneName'] = $zoneName;
/* Generate SOA entry
*/
unset($Zones[$zoneName]);
}else{
$tmp = $ldap->fetch();
- $Zones[$zoneName]['ReverseZone'] = FlipIp(str_replace(".in-addr.arpa","",$tmp['zoneName'][0]));
- $Zones[$zoneName]['InitialReverseZone'] = FlipIp(str_replace(".in-addr.arpa","",$tmp['zoneName'][0]));
+ $Zones[$zoneName]['ReverseZone'] = strtoupper($host_attr['cn'][0])."/".FlipIp(str_replace(".in-addr.arpa","",$tmp['zoneName'][0]));
+ $Zones[$zoneName]['InitialReverseZone'] = strtoupper($host_attr['cn'][0])."/".FlipIp(str_replace(".in-addr.arpa","",$tmp['zoneName'][0]));
}
}
return($Zones);
/* Move old zone to new position
*/
- $oldDn = "zoneName=".$zone['InitialzoneName'].",".$HostDn;
- $newDn = "zoneName=".$zone['zoneName'].",".$HostDn;
- $PrePareZoneEntries[$zone['InitialzoneName']] = $zone['zoneName'];
+ $oldDn = "zoneName=".getNameFromMix($zone['InitialzoneName']).",".$HostDn;
+ $newDn = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
+ $PrePareZoneEntries[$zone['InitialzoneName']] = getNameFromMix($zone['zoneName']);
$move [$oldDn] = $newDn;
}
/* Create forward zone entry and put it in our add queue
*/
- $newDn = "zoneName=".$zone['zoneName'].",".$HostDn;
+ $newDn = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
$obj = $zoneBase;
- $obj['zoneName'] = $zone['zoneName'];
+ $obj['zoneName'] = getNameFromMix($zone['zoneName']);
/* Create sOARecord & add it to the obj
*/
*/
if(!empty($zone['InitialReverseZone'])){
if($zone['InitialReverseZone'] != $zone['ReverseZone']){
- $base = "zoneName=".$zone['zoneName'].",".$HostDn;
- $oldRDn = "zoneName=". FlipIp($zone['InitialReverseZone']).".in-addr.arpa,".$base;
- $newRDn = "zoneName=". FlipIp($zone['ReverseZone']).".in-addr.arpa,".$base;
+ $base = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
+ $oldRDn = "zoneName=". FlipIp(getNameFromMix($zone['InitialReverseZone'])).".in-addr.arpa,".$base;
+ $newRDn = "zoneName=". FlipIp(getNameFromMix($zone['ReverseZone'])).".in-addr.arpa,".$base;
$PrePareZoneEntries[FlipIp($zone['InitialReverseZone']).".in-addr.arpa"] = FlipIp($zone['ReverseZone']).".in-addr.arpa";
$move [$oldRDn] = $newRDn;
}
/* Create Reverse Entry
* And append it to our add queue
*/
- $zone['ReverseZone'] = FlipIp($zone['ReverseZone']).".in-addr.arpa";
- $base = "zoneName=".$zone['zoneName'].",".$HostDn;
+ $zone['ReverseZone'] = FlipIp(getNameFromMix($zone['ReverseZone'])).".in-addr.arpa";
+ $base = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
$newRDn = "zoneName=".$zone['ReverseZone'].",".$base;
$rObj = $obj;
$rObj['zoneName']= $zone['ReverseZone'];
* because they are no longer available in newZones anymore.
*/
foreach($oldZones as $zone) {
- $oldDn = "zoneName=".$zone['InitialzoneName'].",".$HostDn;
+ $oldDn = "zoneName=".getNameFromMix($zone['InitialzoneName']).",".$HostDn;
$del[$oldDn] = "";
}
$ldap = $config->get_ldap_link();
foreach($PrePareZoneEntries as $FromZoneName => $ToZoneName){
$ldap->cd($HostDn);
- $ldap->search("(&(objectClass=dNSZone)(zoneName=".$FromZoneName.")(!(relativeDomainName=@)))",array("zoneName"));
+ $ldap->search("(&(objectClass=dNSZone)(zoneName=".getNameFromMix($FromZoneName).")(!(relativeDomainName=@)))",array("zoneName"));
while($attrs = $ldap->fetch()){
$zoneUpdates[$attrs['dn']] = array("zoneName"=>$ToZoneName);
}
index c63fd9b1c947872ad51b66c2d07da7cc8d663185..a500ce84b9df35f64b12e6bc54d4af218ea0dde6 100644 (file)
/* Get all zone Informations
*/
$this->Zones = getDNSZoneEntries($config,$dn);
-
+
/* If there is at least one entry in this -> types, we have DNS enabled
*/
if(count($this->Zones) == 0){
/* Edited or Added zone
*/
- if(isset($_POST['SaveZoneChanges'])){
+ if((isset($_POST['SaveZoneChanges'])) && is_object($this->dialog)){
$this->dialog->save_object();
/* Check for errors
<input type='image' src='images/edittrash.png' name='delZone_%s'>";
foreach($this->Zones as $zone => $values ){
$ZoneList->AddEntry(array(
- array("string" => $zone),
- array("string" => _("Reverse zone")." : ".$values['ReverseZone']),
+ array("string" => getNameFromMix($zone)),
+ array("string" => _("Reverse zone")." : ".getNameFromMix($values['ReverseZone'])),
array("string" => _("TTL")." : ".$values['sOAttl']),
array("string" => _("Class")." : ".$values['dNSClass']),
- array("string" =>str_replace("%s",base64_encode($zone),$editImg))
+ array("string" => str_replace("%s",base64_encode($zone),$editImg))
));
}
function RemoveZone($id)
{
$zones = $this->getUsedZoneNames();
-
+ $rev ="";
+
if(isset($this->Zones[$id]['InitialReverseZone'])){
- $rev = FlipIp($this->Zones[$id]['InitialReverseZone']);
- }else{
- $rev = FlipIp($this->Zones[$id]['ReverseZone']);
+ $rev = FlipIp(getNameFromMix($this->Zones[$id]['InitialReverseZone']));
+ }elseif(isset($this->Zones[$id]['ReverseZone'])){
+ $rev = FlipIp(getNameFromMix($this->Zones[$id]['ReverseZone']));
}
$zonename = "";
if(isset($this->Zones[$id]['InitialzoneName'])){
- $zonename= $this->Zones[$id]['InitialzoneName'];
+ $zonename= getNameFromMix($this->Zones[$id]['InitialzoneName']);
}
$used = array();
/* Get differences
*/
- $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$this->orig_dn);
+
+ $old_dn = $this->orig_dn;
+ if($old_dn == "new"){
+ $old_dn = $this->dn;
+ }
+
+ $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn);
/* Updated zone entries if reverser or forward name has changed
* Must be done before moving entries, else the given dn is invalid
diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc
index f8866b2defa0f5970a56d455ec87748b6178d77f..6bfe99c8217e54c8603a3d621c07a32f2efb476d 100644 (file)
/* attribute list for save action */
var $ignore_account= TRUE;
- var $attributes = array("zoneName","ReverseZone","dNSClass",
+ var $attributes = array("zoneName","ReverseZone","dNSClass","cn",
"sOAprimary","sOAmail","sOAserial","sOArefresh","sOAretry","sOAexpire","sOAttl");
var $objectclasses = array("whatever");
var $dialog = false;
var $isNew = true;
-
+ var $cn;
var $ZoneObject = array();
function servdnseditZone ($config, $dn= NULL,$attrs = array())
$this->isNew = false;
foreach($this->attributes as $value){
- $this->$value = $attrs[$value];
+ if(isset($attrs[$value])){
+ $this->$value = $attrs[$value];
+ }
}
if(isset($attrs['RECORDS'])){
$this->Records = $attrs['RECORDS'];
$smarty->assign($name,$this->$name);
}
+ /* Set zoneNames without server suffix */
+ foreach(array("zoneName","ReverseZone") as $attr){
+ $smarty->assign($attr,getNameFromMix($this->$attr));
+ }
$div = new DivSelectBox("MxRecords");
$div->setHeight(120);
}
}
+ foreach(array("zoneName","ReverseZone") as $attr){
+ if(isset($_POST[$attr])){
+ $this->$attr = strtoupper($this->cn)."/".$_POST[$attr];
+ }
+ }
+
foreach($this->Records as $id => $value){
if(isset($_POST['RecordTypeSelectedFor_'.$id])){
$this->Records[$id]['type'] = $_POST['RecordTypeSelectedFor_'.$id];
$message[] = _("Your mail address contains '@' replace this with '.' to enable GOsa to create a valid SOA record.");
}
- if($this->zoneName != strtolower($this->zoneName)){
+ if(getNameFromMix($this->zoneName) != strtolower(getNameFromMix($this->zoneName))){
$message[] = _("Only lowercase strings are allowed as zone name.");
}
diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc
index 89b4538e7a9632141cba2e766718db499231966a..385041b425f63839c60b8817243bb95a92cdcb52 100644 (file)
/* Initialise class
*/
$this->RecordTypes = getDnsRecordTypes();
- $this->dn = "zoneName=".$zoneObject['InitialzoneName'].",".$dn;
- $this->zoneName = strtoupper($this->cn)."/".$zoneObject['InitialzoneName'];
- $this->reverseName = strtoupper($this->cn)."/".$zoneObject['InitialReverseZone'];
+ $this->dn = "zoneName=".getNameFromMix($zoneObject['InitialzoneName']).",".$dn;
+ $this->zoneName = $zoneObject['InitialzoneName'];
+ $this->reverseName = $zoneObject['InitialReverseZone'];
/* Get ldap connection
*/
index 19bf04da805af27f57f47fefc2a955c19b614dd9..d3c614a88331bd549b3dc65195652bcd9e6f2958 100644 (file)
/* If isn't DNS account but initially was DNS account
remove all DNS entries
*/
- if(!$this->DNSenabled){
+ if((!$this->DNSenabled) || (!$this->DNS_is_account && !$this->DNSinitially_was_account)){
return;
}else{