More fixes

This commit is contained in:
Pinga 2023-12-14 13:39:07 +02:00
parent 9fe3b3f20a
commit 8a144a6add
2 changed files with 77 additions and 34 deletions

View file

@ -581,6 +581,18 @@ class DomainsController extends Controller
if (!empty($nameservers)) { if (!empty($nameservers)) {
foreach ($nameservers as $index => $nameserver) { foreach ($nameservers as $index => $nameserver) {
$internal_host = false;
$result = $db->select('SELECT tld FROM domain_tld');
foreach ($result as $row) {
if ('.' . strtoupper($domain_extension) === strtoupper($row['tld'])) {
$internal_host = true;
break;
}
}
$hostName_already_exist = $db->selectValue( $hostName_already_exist = $db->selectValue(
'SELECT id FROM host WHERE name = ? LIMIT 1', 'SELECT id FROM host WHERE name = ? LIMIT 1',
[$nameserver] [$nameserver]
@ -615,6 +627,8 @@ class DomainsController extends Controller
} else { } else {
$currentDateTime = new \DateTime(); $currentDateTime = new \DateTime();
$host_date = $currentDateTime->format('Y-m-d H:i:s.v'); $host_date = $currentDateTime->format('Y-m-d H:i:s.v');
if ($internal_host) {
$db->insert( $db->insert(
'host', 'host',
[ [
@ -626,6 +640,18 @@ class DomainsController extends Controller
] ]
); );
$host_id = $db->getlastInsertId(); $host_id = $db->getlastInsertId();
} else {
$db->insert(
'host',
[
'name' => $nameserver,
'clid' => $clid,
'crid' => $clid,
'crdate' => $host_date
]
);
$host_id = $db->getlastInsertId();
}
$db->insert( $db->insert(
'domain_host_map', 'domain_host_map',
@ -643,6 +669,16 @@ class DomainsController extends Controller
] ]
); );
if ($internal_host) {
if (empty($nameserver_ipv4[$index]) && empty($nameserver_ipv6[$index])) {
return view($response, 'admin/domains/createDomain.twig', [
'domainName' => $domainName,
'error' => 'Error: No IPv4 or IPv6 addresses provided for internal host',
'registrars' => $registrars,
'registrar' => $registrar,
]);
}
if (isset($nameserver_ipv4[$index]) && !empty($nameserver_ipv4[$index])) { if (isset($nameserver_ipv4[$index]) && !empty($nameserver_ipv4[$index])) {
$ipv4 = normalize_v4_address($nameserver_ipv4[$index]); $ipv4 = normalize_v4_address($nameserver_ipv4[$index]);
@ -668,6 +704,7 @@ class DomainsController extends Controller
] ]
); );
} }
}
} }
} }

View file

@ -493,6 +493,12 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) {
foreach ($host_addr_list as $node) { foreach ($host_addr_list as $node) {
$addr = (string) $node; $addr = (string) $node;
if (empty($addr)) {
sendEppError($conn, $db, 2303, 'Error: Address is empty', $clTRID, $trans);
return;
}
$addr_type = isset($node['ip']) ? (string) $node['ip'] : 'v4'; $addr_type = isset($node['ip']) ? (string) $node['ip'] : 'v4';
if ($addr_type == 'v6') { if ($addr_type == 'v6') {