mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-13 06:18:17 +02:00
RST updates
This commit is contained in:
parent
270d8dca1e
commit
21cb2a0f0e
4 changed files with 63 additions and 56 deletions
|
@ -685,14 +685,8 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT id FROM tmch_claims WHERE domain_label = ? AND claim_key = ? LIMIT 1");
|
if (strlen($noticeid) !== 27 || !ctype_alnum($noticeid)) {
|
||||||
$stmt->execute([$label, $noticeid]);
|
sendEppError($conn, $db, 2306, 'Invalid noticeID format', $clTRID, $trans);
|
||||||
$claim_valid = $stmt->fetchColumn();
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
if (!$claim_valid) {
|
|
||||||
sendEppError($conn, $db, 2306, 'Invalid or expired claims noticeID for this domain label', $clTRID, $trans);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} elseif ($launch_phase === 'landrush') {
|
} elseif ($launch_phase === 'landrush') {
|
||||||
// Continue
|
// Continue
|
||||||
|
|
|
@ -84,7 +84,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'delete', 'contact', $contact_id, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'delete', 'contact', 'C'.$contact_id, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'delete', 'host', $host_id, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'delete', 'host', $hostName, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ function processContactInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
'resultCode' => 1000,
|
'resultCode' => 1000,
|
||||||
'msg' => 'Command completed successfully',
|
'msg' => 'Command completed successfully',
|
||||||
'id' => $contactRow['identifier'],
|
'id' => $contactRow['identifier'],
|
||||||
'roid' => 'C' . $contactRow['id'] . $roid,
|
'roid' => 'C' . $contactRow['id'] . '-' . $roid,
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'postal' => $postalArray,
|
'postal' => $postalArray,
|
||||||
'voice' => $contactRow['voice'],
|
'voice' => $contactRow['voice'],
|
||||||
|
@ -122,7 +122,7 @@ function processContactInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'info', 'contact', 'C_'.$contactRow['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'info', 'contact', 'C'.$contactRow['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
@ -201,7 +201,7 @@ function processHostInfo($conn, $db, $xml, $trans) {
|
||||||
'resultCode' => 1000,
|
'resultCode' => 1000,
|
||||||
'msg' => 'Command completed successfully',
|
'msg' => 'Command completed successfully',
|
||||||
'name' => $host['name'],
|
'name' => $host['name'],
|
||||||
'roid' => 'H' . $host['id'] . $roid,
|
'roid' => 'H' . $host['id'] . '-' . $roid,
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'addr' => $addrArray,
|
'addr' => $addrArray,
|
||||||
'clID' => getRegistrarClid($db, $host['clid']),
|
'clID' => getRegistrarClid($db, $host['clid']),
|
||||||
|
@ -214,7 +214,7 @@ function processHostInfo($conn, $db, $xml, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'info', 'host', 'H_'.$host['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'info', 'host', $host['name'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||||
|
@ -344,7 +344,7 @@ function processDomainInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
'resultCode' => 1000,
|
'resultCode' => 1000,
|
||||||
'msg' => 'Command completed successfully',
|
'msg' => 'Command completed successfully',
|
||||||
'name' => $domain['name'],
|
'name' => $domain['name'],
|
||||||
'roid' => 'A' . $domain['id'] . $roid,
|
'roid' => 'A' . $domain['id'] . '-' . $roid,
|
||||||
'status' => $status['status'],
|
'status' => $status['status'],
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
|
@ -377,7 +377,7 @@ function processDomainInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'info', 'domain', 'A_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'info', 'domain', $domain['name'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||||
|
@ -512,7 +512,7 @@ function processDomainInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
'resultCode' => 1000,
|
'resultCode' => 1000,
|
||||||
'msg' => 'Command completed successfully',
|
'msg' => 'Command completed successfully',
|
||||||
'name' => $domain['name'],
|
'name' => $domain['name'],
|
||||||
'roid' => 'D' . $domain['id'] . $roid,
|
'roid' => 'D' . $domain['id'] . '-' . $roid,
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
|
@ -581,14 +581,13 @@ function processDomainInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'info', 'domain', 'D_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'info', 'domain', $domain['name'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFundsInfo($conn, $db, $xml, $clid, $trans) {
|
function processFundsInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
|
@ -736,7 +736,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'update', 'contact', $contact_id, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'update', 'contact', 'C'.$contact_id, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,20 +912,30 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT domain_id FROM host WHERE name = ? LIMIT 1");
|
$stmt = $db->prepare("SELECT id, domain_id FROM host WHERE name = ? LIMIT 1");
|
||||||
$stmt->execute([$name]);
|
$stmt->execute([$name]);
|
||||||
$domain_id = $stmt->fetchColumn();
|
$hostRow = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($domain_id) {
|
if ($hostRow) {
|
||||||
|
$domain_id = $hostRow['domain_id'];
|
||||||
|
$host_id = $hostRow['id'];
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT name FROM domain WHERE id = ? LIMIT 1");
|
$stmt = $db->prepare("SELECT name FROM domain WHERE id = ? LIMIT 1");
|
||||||
$stmt->execute([$domain_id]);
|
$stmt->execute([$domain_id]);
|
||||||
$domain_name = $stmt->fetchColumn();
|
$domain_name = $stmt->fetchColumn();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', $chg_name)) {
|
if (!preg_match('/\.' . preg_quote($domain_name, '/') . '$/i', $chg_name)) {
|
||||||
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host name must be a subdomain of '.$domain_name, $clTRID, $trans);
|
$stmt = $db->prepare("SELECT COUNT(*) FROM host_addr WHERE host_id = ?");
|
||||||
return;
|
$stmt->execute([$host_id]);
|
||||||
|
$ipCount = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
if ($ipCount > 0) {
|
||||||
|
sendEppError($conn, $db, 2005, 'Out-of-bailiwick change not allowed: host name must be a subdomain of ' . $domain_name, $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$tlds = $db->query("SELECT tld FROM domain_tld")->fetchAll(PDO::FETCH_COLUMN);
|
$tlds = $db->query("SELECT tld FROM domain_tld")->fetchAll(PDO::FETCH_COLUMN);
|
||||||
|
@ -979,44 +989,48 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
$addr_list = $xml->xpath('//host:rem/host:addr');
|
$addr_list = $xml->xpath('//host:rem/host:addr');
|
||||||
$status_list = $xml->xpath('//host:rem/host:status/@s');
|
$status_list = $xml->xpath('//host:rem/host:status/@s');
|
||||||
|
|
||||||
$removingCount = count($addr_list);
|
if (!empty($addr_list)) {
|
||||||
|
$removingCount = count($addr_list);
|
||||||
|
|
||||||
$stmt = $db->prepare("SELECT COUNT(*) FROM host_addr WHERE host_id = ?");
|
$stmt = $db->prepare("SELECT COUNT(*) FROM host_addr WHERE host_id = ?");
|
||||||
$stmt->execute([$hostId]);
|
$stmt->execute([$hostId]);
|
||||||
$currentCount = $stmt->fetchColumn();
|
$currentCount = $stmt->fetchColumn();
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
if ($currentCount - $removingCount <= 0) {
|
|
||||||
sendEppError($conn, $db, 2306, 'Host must have at least one IP address', $clTRID, $trans);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($addr_list as $node) {
|
|
||||||
$addr = (string) $node;
|
|
||||||
$addr_type = $node->attributes()['ip'] ? (string) $node->attributes()['ip'] : 'v4';
|
|
||||||
|
|
||||||
$normalized_addr = $addr_type === 'v6' ? normalize_v6_address($addr) : normalize_v4_address($addr);
|
|
||||||
|
|
||||||
// Check if this addr exists
|
|
||||||
$stmt = $db->prepare("SELECT id FROM host_addr WHERE host_id = ? AND addr = ? AND ip = ?");
|
|
||||||
$stmt->execute([$hostId, $normalized_addr, $addr_type]);
|
|
||||||
$exists = $stmt->fetchColumn();
|
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$exists) {
|
if ($currentCount - $removingCount <= 0) {
|
||||||
sendEppError($conn, $db, 2306, "host:addr $addr not found for host, cannot remove", $clTRID, $trans);
|
sendEppError($conn, $db, 2306, 'Host must have at least one IP address', $clTRID, $trans);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare("DELETE FROM host_addr WHERE host_id = ? AND addr = ? AND ip = ?");
|
foreach ($addr_list as $node) {
|
||||||
$stmt->execute([$hostId, $normalized_addr, $addr_type]);
|
$addr = (string) $node;
|
||||||
|
$addr_type = $node->attributes()['ip'] ? (string) $node->attributes()['ip'] : 'v4';
|
||||||
|
|
||||||
|
$normalized_addr = $addr_type === 'v6' ? normalize_v6_address($addr) : normalize_v4_address($addr);
|
||||||
|
|
||||||
|
// Check if this addr exists
|
||||||
|
$stmt = $db->prepare("SELECT id FROM host_addr WHERE host_id = ? AND addr = ? AND ip = ?");
|
||||||
|
$stmt->execute([$hostId, $normalized_addr, $addr_type]);
|
||||||
|
$exists = $stmt->fetchColumn();
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
if (!$exists) {
|
||||||
|
sendEppError($conn, $db, 2306, "host:addr $addr not found for host, cannot remove", $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare("DELETE FROM host_addr WHERE host_id = ? AND addr = ? AND ip = ?");
|
||||||
|
$stmt->execute([$hostId, $normalized_addr, $addr_type]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($status_list as $node) {
|
if (!empty($status_list)) {
|
||||||
$status = (string) $node;
|
foreach ($status_list as $node) {
|
||||||
|
$status = (string) $node;
|
||||||
|
|
||||||
$stmt = $db->prepare("DELETE FROM host_status WHERE host_id = ? AND status = ?");
|
$stmt = $db->prepare("DELETE FROM host_status WHERE host_id = ? AND status = ?");
|
||||||
$stmt->execute([$hostId, $status]);
|
$stmt->execute([$hostId, $status]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1102,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
updateTransaction($db, 'update', 'host', $hostId, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
updateTransaction($db, 'update', 'host', $name, 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
sendEppResponse($conn, $xml);
|
sendEppResponse($conn, $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue