Skip to content

Commit

Permalink
Fix for Issue#25
Browse files Browse the repository at this point in the history
  • Loading branch information
stasic authored and Edmondas Girkantas committed Aug 19, 2012
1 parent fcc0909 commit 27c1953
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inc/dns.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function validate_input($rid, $zid, $type, &$content, &$name, &$prio, &$ttl) {
if (!is_valid_rr_cname_unique($name,$rid)) return false;
if (!is_valid_hostname_fqdn($name,1)) return false;
if (!is_valid_hostname_fqdn($content,0)) return false;
if (!is_not_empty_cname_rr($name,$zone)) return false;
break;

case "HINFO":
Expand Down Expand Up @@ -349,6 +350,17 @@ function is_valid_rr_cname_unique($name,$rid) {
return true;
}

/*
* Check that the zone does not have a empty CNAME RR
*/
function is_not_empty_cname_rr($name,$zone) {

if ($name == $zone) {
error(ERR_DNS_CNAME_EMPTY);
return false;
}
return true;
}

function is_valid_non_alias_target($target) {
global $db;
Expand Down
1 change: 1 addition & 0 deletions inc/error.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
define("ERR_DNS_CNAME", _('This is not a valid CNAME. Did you assign an MX or NS record to the record?'));
define("ERR_DNS_CNAME_EXISTS", _('This is not a valid record. There is already exists a CNAME with this name.'));
define("ERR_DNS_CNAME_UNIQUE", _('This is not a valid CNAME. There is already exists an A, AAAA or CNAME with this name.'));
define("ERR_DNS_CNAME_EMPTY", _('Empty CNAME records are not allowed.'));
define("ERR_DNS_NON_ALIAS_TARGET", _('You can not point a NS or MX record to a CNAME record. Remove or rame the CNAME record first, or take another name.'));
define("ERR_DNS_NS_HNAME", _('NS records must be a hostnames.'));
define("ERR_DNS_MX_PRIO", _('A prio field should be numeric.'));
Expand Down

0 comments on commit 27c1953

Please sign in to comment.