More EPP fixes

This commit is contained in:
Pinga 2025-07-09 12:31:17 +03:00
parent 8d3493bb7a
commit 55a1950351
2 changed files with 13 additions and 14 deletions

View file

@ -14,25 +14,24 @@ function processContactCheck($conn, $db, $xml, $trans) {
foreach ($contactIDs as $contactID) { foreach ($contactIDs as $contactID) {
$contactID = (string)$contactID; $contactID = (string)$contactID;
$entry = [$contactID];
$invalid_identifier = validate_identifier($contactID); $invalid_identifier = validate_identifier($contactID);
if ($invalid_identifier) { if ($invalid_identifier) {
$entry[] = 0; sendEppError($conn, $db, 2306, $invalid_identifier, $clTRID, $trans);
$entry[] = $invalid_identifier; return;
} else { }
$entry = [$contactID];
$stmt = $db->prepare("SELECT 1 FROM contact WHERE identifier = :id"); $stmt = $db->prepare("SELECT 1 FROM contact WHERE identifier = :id");
$stmt->execute(['id' => $contactID]); $stmt->execute(['id' => $contactID]);
$available = $stmt->fetch() ? '0' : '1'; $available = $stmt->fetch() ? '0' : '1';
$stmt->closeCursor(); $stmt->closeCursor();
$entry[] = $available; $entry[] = $available;
if (!$available) { if (!$available) {
$entry[] = "In use"; $entry[] = "In use";
} }
}
$ids[] = $entry; $ids[] = $entry;
} }

View file

@ -231,7 +231,7 @@ function validate_label($domain, $pdo) {
return 'Invalid domain name format: must contain at least one dot (.)'; return 'Invalid domain name format: must contain at least one dot (.)';
} }
if ($domain[0] === '.' || substr($domain, -1) === '.') { if ($domain[0] === '.' || substr($domain, -1) === '.') {
return 'Invalid domain name format: cannot start or end with a dot (.)'; return 'Cannot start or end with dot';
} }
// Split domain into labels (subdomains, SLD, TLD) // Split domain into labels (subdomains, SLD, TLD)