mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 09:37:00 +02:00
Added some more error checking to the EPP server
This commit is contained in:
parent
d016220ab8
commit
7273e9a070
2 changed files with 35 additions and 2 deletions
|
@ -4,6 +4,12 @@ function processContactCheck($conn, $db, $xml, $trans) {
|
|||
$contactIDs = $xml->command->check->children('urn:ietf:params:xml:ns:contact-1.0')->check->{'id'};
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
// Check if contactIDs is null or empty
|
||||
if ($contactIDs === null || count($contactIDs) == 0) {
|
||||
sendEppError($conn, $db, 2003, 'contact id', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
$results = [];
|
||||
foreach ($contactIDs as $contactID) {
|
||||
$contactID = (string)$contactID;
|
||||
|
@ -59,6 +65,12 @@ function processHostCheck($conn, $db, $xml, $trans) {
|
|||
$hosts = $xml->command->check->children('urn:ietf:params:xml:ns:host-1.0')->check->{'name'};
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
// Check if hosts is null or empty
|
||||
if ($hosts === null || count($hosts) == 0) {
|
||||
sendEppError($conn, $db, 2003, 'host name', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
$results = [];
|
||||
foreach ($hosts as $host) {
|
||||
$host = (string)$host;
|
||||
|
@ -109,6 +121,12 @@ function processDomainCheck($conn, $db, $xml, $trans) {
|
|||
$domains = $xml->command->check->children('urn:ietf:params:xml:ns:domain-1.0')->check->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
// Check if domains is null or empty
|
||||
if ($domains === null || count($domains) == 0) {
|
||||
sendEppError($conn, $db, 2003, 'domain name', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
$extensionNode = $xml->command->extension;
|
||||
if (isset($extensionNode)) {
|
||||
$launch_check = $xml->xpath('//launch:check')[0] ?? null;
|
||||
|
|
|
@ -4,6 +4,11 @@ function processContactInfo($conn, $db, $xml, $trans) {
|
|||
$contactID = (string) $xml->command->info->children('urn:ietf:params:xml:ns:contact-1.0')->info->{'id'};
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
if (!$contactID) {
|
||||
sendEppError($conn, $db, 2003, 'Missing contact:id', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
// Validation for contact ID
|
||||
$invalid_identifier = validate_identifier($contactID);
|
||||
if ($invalid_identifier) {
|
||||
|
@ -94,6 +99,11 @@ function processHostInfo($conn, $db, $xml, $trans) {
|
|||
$hostName = $xml->command->info->children('urn:ietf:params:xml:ns:host-1.0')->info->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
if (!$hostName) {
|
||||
sendEppError($conn, $db, 2003, 'Specify your host name', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
// Validation for host name
|
||||
if (!preg_match('/^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9]){0,1}\\.){1,125}[A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])$/i', $hostName) && strlen($hostName) > 254) {
|
||||
sendEppError($conn, $db, 2005, 'Invalid host name', $clTRID, $trans);
|
||||
|
@ -172,6 +182,11 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
|||
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
if (!$domainName) {
|
||||
sendEppError($conn, $db, 2003, 'Please specify a domain name', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
$extensionNode = $xml->command->extension;
|
||||
if (isset($extensionNode)) {
|
||||
$launch_info = $xml->xpath('//launch:info')[0] ?? null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue