Domain parsing fixes

This commit is contained in:
Pinga 2023-12-14 13:17:37 +02:00
parent d172717f0a
commit 9fe3b3f20a
10 changed files with 175 additions and 23 deletions

View file

@ -535,7 +535,7 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) {
$stmt->execute([$hostName, $clid, $clid]);
$host_id = $db->lastInsertId();
$host_status = 'ok';
$stmt = $db->prepare("INSERT INTO host_status (host_id,status) VALUES(?,?)");
$stmt->execute([$host_id, $host_status]);
@ -567,8 +567,11 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) {
function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
$domainName = $xml->command->create->children('urn:ietf:params:xml:ns:domain-1.0')->create->name;
$clTRID = (string) $xml->command->clTRID;
$parts = extractDomainAndTLD($domainName);
$label = $parts['domain'];
$domain_extension = $parts['tld'];
list($label, $domain_extension) = explode('.', $domainName, 2);
$invalid_domain = validate_label($domainName, $db);
if ($invalid_domain) {
@ -602,7 +605,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
}
$stmt = $db->prepare("SELECT id FROM reserved_domain_names WHERE name = ? LIMIT 1");
$stmt->execute([$domainName]);
$stmt->execute([$label]);
$domain_already_reserved = $stmt->fetchColumn();
if ($domain_already_reserved) {