mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-12 22:08:12 +02:00
More RST updates
This commit is contained in:
parent
53dc8c60c4
commit
91f5b7d824
3 changed files with 39 additions and 28 deletions
|
@ -689,6 +689,14 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
||||||
sendEppError($conn, $db, 2003, 'Invalid dates: acceptedDate must be before notAfter', $clTRID, $trans);
|
sendEppError($conn, $db, 2003, 'Invalid dates: acceptedDate must be before notAfter', $clTRID, $trans);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$currentTime = new DateTime('now', new DateTimeZone('UTC'));
|
||||||
|
$interval = $currentTime->getTimestamp() - $acceptedDate->getTimestamp();
|
||||||
|
|
||||||
|
if ($interval > 172800) { // 172800 seconds = 48 hours
|
||||||
|
sendEppError($conn, $db, 2003, 'Invalid acceptedDate: must be within 48 hours of current time', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
sendEppError($conn, $db, 2003, 'Invalid date format', $clTRID, $trans);
|
sendEppError($conn, $db, 2003, 'Invalid date format', $clTRID, $trans);
|
||||||
return;
|
return;
|
||||||
|
@ -696,6 +704,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
||||||
|
|
||||||
if (!validateTcnId($domainName, $noticeid, $launch_notAfter)) {
|
if (!validateTcnId($domainName, $noticeid, $launch_notAfter)) {
|
||||||
sendEppError($conn, $db, 2306, 'Invalid TMCH claims noticeID format', $clTRID, $trans);
|
sendEppError($conn, $db, 2306, 'Invalid TMCH claims noticeID format', $clTRID, $trans);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} elseif ($launch_phase === 'landrush') {
|
} elseif ($launch_phase === 'landrush') {
|
||||||
// Continue
|
// Continue
|
||||||
|
|
|
@ -122,7 +122,7 @@ function processContactInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'info', 'contact', 'C'.$contactRow['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'info', 'contact', $contactID, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
|
@ -921,37 +921,39 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$domain_id = $hostRow['domain_id'];
|
$domain_id = $hostRow['domain_id'];
|
||||||
$host_id = $hostRow['id'];
|
$host_id = $hostRow['id'];
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT name FROM domain WHERE id = ? LIMIT 1");
|
// Subordinate host
|
||||||
$stmt->execute([$domain_id]);
|
if ($domain_id) {
|
||||||
$domain_name = $stmt->fetchColumn();
|
$stmt = $db->prepare("SELECT name FROM domain WHERE id = ? LIMIT 1");
|
||||||
$stmt->closeCursor();
|
$stmt->execute([$domain_id]);
|
||||||
|
$domain_name = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', $chg_name)) {
|
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', strtolower($chg_name))) {
|
||||||
if (!isset($hostRem)) {
|
// Renaming to another domain → not allowed
|
||||||
$stmt = $db->prepare("SELECT COUNT(*) FROM host_addr WHERE host_id = ?");
|
sendEppError($conn, $db, 2304, 'Out-of-bailiwick renaming is not allowed for subordinate hosts', $clTRID, $trans);
|
||||||
$stmt->execute([$host_id]);
|
return;
|
||||||
$ipCount = $stmt->fetchColumn();
|
}
|
||||||
$stmt->closeCursor();
|
} else {
|
||||||
|
// External host
|
||||||
if ($ipCount > 0) {
|
$tlds = $db->query("SELECT tld FROM domain_tld")->fetchAll(PDO::FETCH_COLUMN);
|
||||||
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host name must be a subdomain of ' . $domain_name, $clTRID, $trans);
|
$internal_host = false;
|
||||||
return;
|
foreach ($tlds as $tld) {
|
||||||
|
if (str_ends_with(strtolower($chg_name), strtolower($tld))) {
|
||||||
|
$internal_host = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$tlds = $db->query("SELECT tld FROM domain_tld")->fetchAll(PDO::FETCH_COLUMN);
|
|
||||||
$internal_host = false;
|
|
||||||
foreach ($tlds as $tld) {
|
|
||||||
if (str_ends_with(strtolower($chg_name), strtolower($tld))) {
|
|
||||||
$internal_host = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($internal_host) {
|
if ($internal_host) {
|
||||||
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host must be external to registry-managed domains', $clTRID, $trans);
|
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host must be external to registry-managed domains', $clTRID, $trans);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// External + new name is also external → delete IPs if not explicitly removed
|
||||||
|
if (!isset($hostRem)) {
|
||||||
|
$stmt = $db->prepare("DELETE FROM host_addr WHERE host_id = ?");
|
||||||
|
$stmt->execute([$host_id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue