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

View file

@ -231,7 +231,7 @@ function validate_label($domain, $pdo) {
return 'Invalid domain name format: must contain at least one dot (.)';
}
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)