A few more fixes for RST

This commit is contained in:
Pinga 2025-07-09 13:30:32 +03:00
parent 55a1950351
commit 120a393ea1
3 changed files with 14 additions and 21 deletions

View file

@ -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'];

View file

@ -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'];

View file

@ -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