More RST updates

This commit is contained in:
Pinga 2025-05-13 19:09:20 +03:00
parent 53dc8c60c4
commit 91f5b7d824
3 changed files with 39 additions and 28 deletions

View file

@ -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);
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) {
sendEppError($conn, $db, 2003, 'Invalid date format', $clTRID, $trans);
return;
@ -696,6 +704,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
if (!validateTcnId($domainName, $noticeid, $launch_notAfter)) {
sendEppError($conn, $db, 2306, 'Invalid TMCH claims noticeID format', $clTRID, $trans);
return;
}
} elseif ($launch_phase === 'landrush') {
// Continue

View file

@ -122,7 +122,7 @@ function processContactInfo($conn, $db, $xml, $clid, $trans) {
$epp = new EPP\EppWriter();
$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);
} catch (PDOException $e) {

View file

@ -921,25 +921,20 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$domain_id = $hostRow['domain_id'];
$host_id = $hostRow['id'];
// Subordinate host
if ($domain_id) {
$stmt = $db->prepare("SELECT name FROM domain WHERE id = ? LIMIT 1");
$stmt->execute([$domain_id]);
$domain_name = $stmt->fetchColumn();
$stmt->closeCursor();
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', $chg_name)) {
if (!isset($hostRem)) {
$stmt = $db->prepare("SELECT COUNT(*) FROM host_addr WHERE host_id = ?");
$stmt->execute([$host_id]);
$ipCount = $stmt->fetchColumn();
$stmt->closeCursor();
if ($ipCount > 0) {
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host name must be a subdomain of ' . $domain_name, $clTRID, $trans);
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', strtolower($chg_name))) {
// Renaming to another domain → not allowed
sendEppError($conn, $db, 2304, 'Out-of-bailiwick renaming is not allowed for subordinate hosts', $clTRID, $trans);
return;
}
}
}
} else {
// External host
$tlds = $db->query("SELECT tld FROM domain_tld")->fetchAll(PDO::FETCH_COLUMN);
$internal_host = false;
foreach ($tlds as $tld) {
@ -953,6 +948,13 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host must be external to registry-managed domains', $clTRID, $trans);
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]);
}
}
}
// Check if new host name already exists