inc/dns.inc.php
changeset 65 ce1c4d5e1576
parent 62 ce4919f37489
child 71 e1b918eaf69a
equal deleted inserted replaced
64:dab0e9deeb67 65:ce1c4d5e1576
   243 
   243 
   244 	// Check if there are other records with this information of the following types.
   244 	// Check if there are other records with this information of the following types.
   245 	// P.S. we might add CNAME to block CNAME recursion and chains.
   245 	// P.S. we might add CNAME to block CNAME recursion and chains.
   246 	$blockedtypes = " AND (type='MX' OR type='NS')";
   246 	$blockedtypes = " AND (type='MX' OR type='NS')";
   247 
   247 
   248 	$cnamec = "SELECT type, content FROM records WHERE content='$dest'" . $blockedtypes;
   248 	$cnamec = "SELECT type, content FROM records WHERE content=".$db->quote($dest) . $blockedtypes;
   249 	$result = $db->query($cnamec);
   249 	$result = $db->query($cnamec);
   250 
   250 
   251 	if($result->numRows() > 0)
   251 	if($result->numRows() > 0)
   252 	{
   252 	{
   253 		return false;
   253 		return false;
   380 function is_valid_mx($content, &$prio)
   380 function is_valid_mx($content, &$prio)
   381 {
   381 {
   382 	global $db;
   382 	global $db;
   383 	// See if the destination to which this MX is pointing is NOT a CNAME record.
   383 	// See if the destination to which this MX is pointing is NOT a CNAME record.
   384 	// Check inside our dns server.
   384 	// Check inside our dns server.
   385 	if($db->queryOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0)
   385 	if($db->queryOne("SELECT count(id) FROM records WHERE name=".$db->quote($content)." AND type='CNAME'") > 0)
   386 	{
   386 	{
   387 		return -1;
   387 		return -1;
   388 	}
   388 	}
   389 	else
   389 	else
   390 	{
   390 	{
   423 	{
   423 	{
   424 		return -1;
   424 		return -1;
   425 		// "an IN NS field must be a hostname."
   425 		// "an IN NS field must be a hostname."
   426 	}
   426 	}
   427 
   427 
   428 	if($db->queryOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0)
   428 	if($db->queryOne("SELECT count(id) FROM records WHERE name=".$db->quote($content)." AND type='CNAME'") > 0)
   429 	{
   429 	{
   430 		return -2;
   430 		return -2;
   431 		// "You can not point a NS record to a CNAME record. Remove/rename the CNAME record first or take another name."
   431 		// "You can not point a NS record to a CNAME record. Remove/rename the CNAME record first or take another name."
   432 
   432 
   433 	}
   433 	}