From 55a19503512276bd4d0dea3598e9a23a1c217cbb Mon Sep 17 00:00:00 2001 From: Pinga Date: Wed, 9 Jul 2025 12:31:17 +0300 Subject: [PATCH] More EPP fixes --- epp/src/epp-check.php | 25 ++++++++++++------------- epp/src/helpers.php | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/epp/src/epp-check.php b/epp/src/epp-check.php index 96d0395..357c2d7 100644 --- a/epp/src/epp-check.php +++ b/epp/src/epp-check.php @@ -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; diff --git a/epp/src/helpers.php b/epp/src/helpers.php index 7fd263a..8e9d06e 100644 --- a/epp/src/helpers.php +++ b/epp/src/helpers.php @@ -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)