From 120a393ea15afa6ee618d6cf845df3ebdc024050 Mon Sep 17 00:00:00 2001 From: Pinga Date: Wed, 9 Jul 2025 13:30:32 +0300 Subject: [PATCH] A few more fixes for RST --- epp/src/epp-check.php | 27 ++++++++++----------------- epp/src/epp-create.php | 6 +++--- epp/src/helpers.php | 2 +- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/epp/src/epp-check.php b/epp/src/epp-check.php index 357c2d7..652f668 100644 --- a/epp/src/epp-check.php +++ b/epp/src/epp-check.php @@ -135,6 +135,15 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) { return; } + foreach ($domains as $domain) { + $domainName = (string) $domain; + $invalid_label = validate_label($domainName, $db); + if ($invalid_label) { + sendEppError($conn, $db, 2306, ucfirst($invalid_label), $clTRID, $trans); + return; + } + } + $extensionNode = $xml->command->extension; if (isset($extensionNode)) { $launch_check = $xml->xpath('//launch:check')[0] ?? null; @@ -234,15 +243,7 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) { $domainEntry[] = 0; // Set status to unavailable $domainEntry[] = ucfirst($reserved); // Capitalize the first letter } else { - $invalid_label = validate_label($domainName, $db); - - // Check if the domain is Invalid - if ($invalid_label) { - $domainEntry[] = 0; // Set status to unavailable - $domainEntry[] = ucfirst($invalid_label); // Capitalize the first letter - } else { - $domainEntry[] = 1; // Domain is available - } + $domainEntry[] = 1; // Domain is available } } @@ -268,14 +269,6 @@ function processDomainCheck($conn, $db, $xml, $trans, $clid) { $domainName = (string) $domain; $domainEntry = [$domainName]; - $invalid_label = validate_label($domainName, $db); - if ($invalid_label) { - $domainEntry[] = 0; // Unavailable - $domainEntry[] = ucfirst($invalid_label); - $names[] = $domainEntry; - continue; - } - $parts = extractDomainAndTLD($domainName); $label = $parts['domain']; diff --git a/epp/src/epp-create.php b/epp/src/epp-create.php index ffbe65b..2a6cd65 100644 --- a/epp/src/epp-create.php +++ b/epp/src/epp-create.php @@ -290,11 +290,11 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $disclose_fax = 1; $disclose_email = 1; $disclose_name_int = 1; - $disclose_name_loc = 1; + $disclose_name_loc = 0; $disclose_org_int = 1; - $disclose_org_loc = 1; + $disclose_org_loc = 0; $disclose_addr_int = 1; - $disclose_addr_loc = 1; + $disclose_addr_loc = 0; foreach ($contact_disclose as $node_disclose) { $flag = (string)$node_disclose['flag']; diff --git a/epp/src/helpers.php b/epp/src/helpers.php index 8e9d06e..0049522 100644 --- a/epp/src/helpers.php +++ b/epp/src/helpers.php @@ -247,7 +247,7 @@ function validate_label($domain, $pdo) { } if (!preg_match('/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/', $label)) { - return 'The domain must start and end with a letter or number and contain only letters, numbers, or hyphens'; + return 'Invalid: only a-z, 0-9, hyphen'; } } // Basic validation for other labels