diff --git a/epp/src/epp-check.php b/epp/src/epp-check.php index cb89879..02c4b6a 100644 --- a/epp/src/epp-check.php +++ b/epp/src/epp-check.php @@ -60,7 +60,7 @@ function processHostCheck($conn, $db, $xml) { // 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', $host) && strlen($host) > 254) { - sendEppError($conn, 2005, 'Invalid host name'); + sendEppError($conn, 2005, 'Invalid host name', $clTRID); return; } diff --git a/epp/src/epp-create.php b/epp/src/epp-create.php index ada2a63..aaa3b3d 100644 --- a/epp/src/epp-create.php +++ b/epp/src/epp-create.php @@ -5,14 +5,14 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $clTRID = (string) $xml->command->clTRID; if (!$contactID) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } // Validation for contact ID $invalid_identifier = validate_identifier($contactID); if ($invalid_identifier) { - sendEppError($conn, 2005, 'Invalid contact ID'); + sendEppError($conn, 2005, 'Invalid contact ID', $clTRID); return; } @@ -22,7 +22,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $contact = $stmt->fetch(PDO::FETCH_ASSOC); if ($contact) { - sendEppError($conn, 2302, 'Contact ID already exists'); + sendEppError($conn, 2302, 'Contact ID already exists', $clTRID); return; } @@ -65,64 +65,64 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $postalInfoIntCc = (string) $postalInfoInt->addr->cc; if (!$postalInfoIntName) { - sendEppError($conn, 2003, 'Missing contact:name'); + sendEppError($conn, 2003, 'Missing contact:name', $clTRID); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntName)) { - sendEppError($conn, 2005, 'Invalid contact:name'); + sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); return; } if ($postalInfoIntOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org'); + sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); return; } } if ($postalInfoIntStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if ($postalInfoIntStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if ($postalInfoIntStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoIntCity)) { - sendEppError($conn, 2005, 'Invalid contact:city'); + sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); return; } if ($postalInfoIntSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoIntSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp'); + sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); return; } } if ($postalInfoIntPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoIntPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoIntPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc'); + sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); return; } } if (!preg_match('/^(AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW)$/', $postalInfoIntCc)) { - sendEppError($conn, 2005, 'Invalid contact:cc'); + sendEppError($conn, 2005, 'Invalid contact:cc', $clTRID); return; } } @@ -148,70 +148,70 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $postalInfoLocCc = (string) $postalInfoLoc->addr->cc; if (!$postalInfoLocName) { - sendEppError($conn, 2003, 'Missing contact:name'); + sendEppError($conn, 2003, 'Missing contact:name', $clTRID); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocName)) { - sendEppError($conn, 2005, 'Invalid contact:name'); + sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); return; } if ($postalInfoLocOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org'); + sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); return; } } if ($postalInfoLocStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if ($postalInfoLocStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if ($postalInfoLocStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street'); + sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoLocCity)) { - sendEppError($conn, 2005, 'Invalid contact:city'); + sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); return; } if ($postalInfoLocSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoLocSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp'); + sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); return; } } if ($postalInfoLocPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoLocPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoLocPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc'); + sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); return; } } if (!preg_match('/^(AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW)$/', $postalInfoLocCc)) { - sendEppError($conn, 2005, 'Invalid contact:cc'); + sendEppError($conn, 2005, 'Invalid contact:cc', $clTRID); return; } } if (!$postalInfoInt && !$postalInfoLoc) { - sendEppError($conn, 2003, 'Missing contact:postalInfo'); + sendEppError($conn, 2003, 'Missing contact:postalInfo', $clTRID); return; } @@ -220,7 +220,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $voice = (string) $contactCreate->voice; $voice_x = (string) $contactCreate->voice->attributes()->x; if ($voice && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $voice) || strlen($voice) > 17)) { - sendEppError($conn, 2005, 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})'); + sendEppError($conn, 2005, 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID); return; } @@ -230,34 +230,34 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $fax_x = (string) $contactCreate->fax->attributes()->x; } if ($fax && (!preg_match('/^\+\d{1,3}\.\d{1,14}$/', $fax) || strlen($fax) > 17)) { - sendEppError($conn, 2005, 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})'); + sendEppError($conn, 2005, 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID); return; } $email = (string) $contactCreate->email; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - sendEppError($conn, 2005, 'Email address failed check'); + sendEppError($conn, 2005, 'Email address failed check', $clTRID); return; } $authInfo_pw = (string) $contactCreate->authInfo->pw; if (!$authInfo_pw) { - sendEppError($conn, 2003, 'Missing contact:pw'); + sendEppError($conn, 2003, 'Missing contact:pw', $clTRID); return; } if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { - sendEppError($conn, 2005, 'Password needs to be at least 6 and up to 16 characters long'); + sendEppError($conn, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should have both upper and lower case characters'); + sendEppError($conn, 2005, 'Password should have both upper and lower case characters', $clTRID); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should contain one or more numbers'); + sendEppError($conn, 2005, 'Password should contain one or more numbers', $clTRID); return; } @@ -311,11 +311,11 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $nin_type = (string)$obj_ext->xpath('identica:nin/@type')[0] ?? ''; if (!preg_match('/\d/', $nin)) { - sendEppError($conn, 2005, 'NIN should contain one or more numbers'); + sendEppError($conn, 2005, 'NIN should contain one or more numbers', $clTRID); return; } if (!in_array($nin_type, ['personal', 'business'])) { - sendEppError($conn, 2005, 'NIN type is invalid'); + sendEppError($conn, 2005, 'NIN type is invalid', $clTRID); return; } } @@ -370,7 +370,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type) { $crdate = $stmt->fetchColumn(); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error'); + sendEppError($conn, 2400, 'Database error', $clTRID); return; } @@ -397,17 +397,17 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) { 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) { $host_id_already_exist = $db->query("SELECT id FROM host WHERE name = '$hostName' LIMIT 1")->fetchColumn(); if ($host_id_already_exist) { - sendEppError($conn, 2302, 'host:name already exists'); + sendEppError($conn, 2302, 'host:name already exists', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Invalid host:name'); + sendEppError($conn, 2005, 'Invalid host:name', $clTRID); return; } $host_addr_list = $xml->xpath('//addr'); if (count($host_addr_list) > 13) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -431,19 +431,19 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) { // v6 IP validation if ($addr_type === 'v6' && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - sendEppError($conn, 2005, 'Invalid host:addr v6'); + sendEppError($conn, 2005, 'Invalid host:addr v6', $clTRID); return; } // v4 IP validation if ($addr_type !== 'v6' && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { - sendEppError($conn, 2005, 'Invalid host:addr v4'); + sendEppError($conn, 2005, 'Invalid host:addr v4', $clTRID); return; } // check for duplicate IPs if (isset($nsArr[$addr_type][$addr])) { - sendEppError($conn, 2306, 'Duplicated host:addr'); + sendEppError($conn, 2306, 'Duplicated host:addr', $clTRID); return; } @@ -478,12 +478,12 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) { } if (!$domain_exist) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } if ($clid != $clid_domain) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -567,7 +567,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $invalid_domain = validate_label($domainName, $db); if ($invalid_domain) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -583,7 +583,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { } if (!$valid_tld) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -592,7 +592,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $domain_already_exist = $stmt->fetchColumn(); if ($domain_already_exist) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } @@ -601,7 +601,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $domain_already_reserved = $stmt->fetchColumn(); if ($domain_already_reserved) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } @@ -611,7 +611,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $period_unit = (string) $periodElement['unit']; if ($period && (($period < 1) || ($period > 99))) { - sendEppError($conn, 2004, 'Parameter value range error'); + sendEppError($conn, 2004, 'Parameter value range error', $clTRID); return; } elseif (!$period) { $period = 1; @@ -619,7 +619,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { if ($period_unit) { if (!preg_match('/^(m|y)$/', $period_unit)) { - sendEppError($conn, 2004, 'Parameter value range error'); + sendEppError($conn, 2004, 'Parameter value range error', $clTRID); return; } } else { @@ -634,7 +634,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { } if (!preg_match("/^(12|24|36|48|60|72|84|96|108|120)$/", $date_add)) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -658,12 +658,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (!$price) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'Billing failure'); + sendEppError($conn, 2104, 'Billing failure', $clTRID); return; } @@ -672,24 +672,24 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $hostAttr_list = $ns->xpath('//domain:hostAttr'); if (count($hostObj_list) > 0 && count($hostAttr_list) > 0) { - sendEppError($conn, 2001, 'Command syntax error'); + sendEppError($conn, 2001, 'Command syntax error', $clTRID); return; } if (count($hostObj_list) > 13) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } if (count($hostAttr_list) > 13) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } $nsArr = []; foreach ($hostObj_list as $hostObj) { if (isset($nsArr[(string)$hostObj])) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } $nsArr[(string)$hostObj] = 1; @@ -698,7 +698,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $nsArr = []; foreach ($ns->xpath('//domain:hostAttr/domain:hostName') as $hostName) { if (isset($nsArr[(string)$hostName])) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } $nsArr[(string)$hostName] = 1; @@ -709,7 +709,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $hostObj = strtoupper((string)$node); if (preg_match("/[^A-Z0-9\.\-]/", $hostObj) || preg_match("/^-|^\.|-\.|\.-|\.\.|-$|\.$/", $hostObj)) { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } @@ -722,11 +722,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $host_id_already_exist = $stmt->fetch(PDO::FETCH_COLUMN); if (!$host_id_already_exist) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } @@ -737,7 +737,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $hostName = strtoupper((string)$node->xpath('//domain:hostName')[0]); if (preg_match("/[^A-Z0-9\.\-]/", $hostName) || preg_match("/^-|^\.-|-\.$|^\.$/", $hostName)) { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } @@ -759,7 +759,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $hostAddrNodes = $node->xpath('//domain:hostAddr'); if (count($hostAddrNodes) > 13) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -767,14 +767,14 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { foreach ($hostAddrNodes as $hostAddrNode) { $hostAddr = (string)$hostAddrNode; if (isset($nsArr[$hostAddr])) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } $nsArr[$hostAddr] = true; } if (count($hostAddrNodes) === 0) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -796,7 +796,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // true // Additional verifications for reserved or private IPs as per [RFC5735] [RFC5156] can go here. } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } else { @@ -805,11 +805,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // true // Additional verifications for reserved or private IPs as per [RFC5735] [RFC5156] can go here. if ($hostAddr == '127.0.0.1') { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } @@ -835,17 +835,17 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // Object does not exist error if (!$domain_exist) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } // Authorization error if ($clid != $clid_domain) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } @@ -853,7 +853,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // Max 13 IP per host if (count($hostAddr_list) > 13) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -862,7 +862,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { foreach ($hostAddr_list as $node) { $hostAddr = (string) $node; if (isset($nsArr[$hostAddr])) { - sendEppError($conn, 2302, 'Object exists'); + sendEppError($conn, 2302, 'Object exists', $clTRID); return; } $nsArr[$hostAddr] = 1; @@ -870,7 +870,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // Check for missing host addresses if (count($hostAddr_list) === 0) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -893,7 +893,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // true // Add check for reserved or private IP addresses (not implemented here, add as needed) } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } else { @@ -904,11 +904,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // true // Add check for reserved or private IP addresses (not implemented here, add as needed) if ($hostAddr === '127.0.0.1') { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } @@ -919,7 +919,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { 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) { } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } } @@ -939,12 +939,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } if ($clid != $row['clid']) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } } @@ -956,7 +956,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { // Max five contacts per domain name for each type if ($size > 5) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -970,12 +970,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } if ($clid != $row['clid']) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } } @@ -984,22 +984,22 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type) { $authInfo_pw = $xml->xpath('//domain:authInfo/domain:pw[1]')[0] ?? null; if (!$authInfo_pw) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 16) { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } diff --git a/epp/src/epp-delete.php b/epp/src/epp-delete.php index 9bec14b..0eff945 100644 --- a/epp/src/epp-delete.php +++ b/epp/src/epp-delete.php @@ -5,7 +5,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $clTRID = (string) $xml->command->clTRID; if (!$contactID) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -17,7 +17,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $registrar_id_contact = $row['clid'] ?? null; if (!$contact_id) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -28,7 +28,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $clid = $clid['id']; if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -37,7 +37,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $registrantExists = $stmt->fetchColumn(); if ($registrantExists) { - sendEppError($conn, 2305, 'Object association prohibits operation'); + sendEppError($conn, 2305, 'Object association prohibits operation', $clTRID); return; } @@ -46,7 +46,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $contactInUse = $stmt->fetchColumn(); if ($contactInUse) { - sendEppError($conn, 2305, 'Object association prohibits operation'); + sendEppError($conn, 2305, 'Object association prohibits operation', $clTRID); return; } @@ -55,7 +55,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { while ($status = $stmt->fetchColumn()) { if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'Object status prohibits operation'); + sendEppError($conn, 2304, 'Object status prohibits operation', $clTRID); return; } } @@ -69,7 +69,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type) { $stmt->execute([$contact_id]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -92,7 +92,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type) { $clTRID = (string) $xml->command->clTRID; if (!$hostName) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -105,7 +105,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type) { $registrar_id_host = $result['clid'] ?? null; if (!$host_id) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -116,7 +116,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type) { $clid = $clid['id']; if ($clid !== $registrar_id_host) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -126,7 +126,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type) { $nameserver_inuse = $stmt->fetchColumn(); if ($nameserver_inuse) { - sendEppError($conn, 2305, 'Object association prohibits operation'); + sendEppError($conn, 2305, 'Object association prohibits operation', $clTRID); return; } @@ -143,7 +143,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type) { $stmt->execute([':host_id' => $host_id]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -166,7 +166,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $clTRID = (string) $xml->command->clTRID; if (!$domainName) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -180,7 +180,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $result = $stmt->fetch(PDO::FETCH_ASSOC); if (!$result) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -213,7 +213,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $clid = $clid['id']; if ($clid != $registrar_id_domain) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -222,7 +222,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $status = $row['status']; if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'Object status prohibits operation'); + sendEppError($conn, 2304, 'Object status prohibits operation', $clTRID); return; } } @@ -253,7 +253,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -287,7 +287,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $stmt->execute([$domain_id]); if ($stmt->errorCode() != "00000") { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -311,7 +311,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -335,7 +335,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } @@ -361,7 +361,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } diff --git a/epp/src/epp-info.php b/epp/src/epp-info.php index caee743..59dcf7d 100644 --- a/epp/src/epp-info.php +++ b/epp/src/epp-info.php @@ -7,7 +7,7 @@ function processContactInfo($conn, $db, $xml) { // Validation for contact ID $invalid_identifier = validate_identifier($contactID); if ($invalid_identifier) { - sendEppError($conn, 2005, 'Invalid contact ID'); + sendEppError($conn, 2005, 'Invalid contact ID', $clTRID); return; } @@ -18,7 +18,7 @@ function processContactInfo($conn, $db, $xml) { $contact = $stmt->fetch(PDO::FETCH_ASSOC); if (!$contact) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -84,7 +84,7 @@ function processContactInfo($conn, $db, $xml) { sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error'); + sendEppError($conn, 2400, 'Database error', $clTRID); } } @@ -94,7 +94,7 @@ function processHostInfo($conn, $db, $xml) { // 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, 2005, 'Invalid host name'); + sendEppError($conn, 2005, 'Invalid host name', $clTRID); return; } @@ -105,7 +105,7 @@ function processHostInfo($conn, $db, $xml) { $host = $stmt->fetch(PDO::FETCH_ASSOC); if (!$host) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -160,7 +160,7 @@ function processHostInfo($conn, $db, $xml) { $xml = $epp->epp_writer($response); sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error'); + sendEppError($conn, 2400, 'Database error', $clTRID); } } @@ -171,12 +171,12 @@ function processDomainInfo($conn, $db, $xml) { // Validation for domain name $invalid_label = validate_label($domainName, $db); if ($invalid_label) { - sendEppError($conn, 2005, 'Invalid domain name'); + sendEppError($conn, 2005, 'Invalid domain name', $clTRID); return; } if (!filter_var($domainName, FILTER_VALIDATE_DOMAIN)) { - sendEppError($conn, 2005, 'Invalid domain name'); + sendEppError($conn, 2005, 'Invalid domain name', $clTRID); return; } @@ -187,7 +187,7 @@ function processDomainInfo($conn, $db, $xml) { $domain = $stmt->fetch(PDO::FETCH_ASSOC); if (!$domain) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -254,7 +254,7 @@ function processDomainInfo($conn, $db, $xml) { $xml = $epp->epp_writer($response); sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error'); + sendEppError($conn, 2400, 'Database error', $clTRID); } } @@ -272,7 +272,7 @@ function processFundsInfo($conn, $db, $xml, $clid) { $availableCredit = number_format($availableCredit, 2, '.', ''); if (!$funds) { - sendEppError($conn, 2303, 'Registrar does not exist'); + sendEppError($conn, 2303, 'Registrar does not exist', $clTRID); return; } @@ -295,6 +295,6 @@ function processFundsInfo($conn, $db, $xml, $clid) { sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error'); + sendEppError($conn, 2400, 'Database error', $clTRID); } } \ No newline at end of file diff --git a/epp/src/epp-renew.php b/epp/src/epp-renew.php index 6dc56e9..2fad3e7 100644 --- a/epp/src/epp-renew.php +++ b/epp/src/epp-renew.php @@ -10,7 +10,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { $clTRID = (string) $xml->command->clTRID; if (!$domainName) { - sendEppError($conn, 2003, 'Required parameter missing '); + sendEppError($conn, 2003, 'Required parameter missing ', $clTRID); return; } @@ -39,12 +39,12 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { $domainData = $stmt->fetch(PDO::FETCH_ASSOC); if (!$domainData) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } if ($clid['id'] != $domainData['clid']) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -56,7 +56,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $status = $row['status']; if (preg_match('/.*(RenewProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'Object status prohibits operation'); + sendEppError($conn, 2304, 'Object status prohibits operation', $clTRID); return; } } @@ -64,7 +64,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { $expiration_date = explode(" ", $domainData['exdate'])[0]; // remove time, keep only date if ($curExpDate !== $expiration_date) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -78,7 +78,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { if ($date_add > 0) { // The number of units available MAY be subject to limits imposed by the server. if (!in_array($date_add, [12, 24, 36, 48, 60, 72, 84, 96, 108, 120])) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -91,7 +91,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { // Domains can be renewed at any time, but the expire date cannot be more than 10 years in the future. if ($after_renew > $after_10_years) { - sendEppError($conn, 2306, 'Parameter value policy error'); + sendEppError($conn, 2306, 'Parameter value policy error', $clTRID); return; } @@ -110,7 +110,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { $price = $stmt->fetchColumn(); if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'Billing failure'); + sendEppError($conn, 2104, 'Billing failure', $clTRID); return; } @@ -130,7 +130,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type) { // Error check $errorInfo = $stmt->errorInfo(); if (isset($errorInfo[2])) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } else { // Update registrar's account balance: diff --git a/epp/src/epp-transfer.php b/epp/src/epp-transfer.php index ea4096d..b212293 100644 --- a/epp/src/epp-transfer.php +++ b/epp/src/epp-transfer.php @@ -11,7 +11,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $authInfo_pw = (string)$obj->xpath('//contact:authInfo/contact:pw[1]')[0]; if (!$contactID) { - sendEppError($conn, 2003, 'Required parameter missing'); + sendEppError($conn, 2003, 'Required parameter missing', $clTRID); return; } @@ -23,7 +23,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $registrar_id_contact = $result['clid'] ?? null; if (!$contact_id) { - sendEppError($conn, 2303, 'Object does not exist'); + sendEppError($conn, 2303, 'Object does not exist', $clTRID); return; } @@ -35,7 +35,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { if ($op === 'approve') { if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -48,7 +48,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'Invalid authorization information'); + sendEppError($conn, 2202, 'Invalid authorization information', $clTRID); return; } } @@ -67,7 +67,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { ]); if ($stmt->errorCode() != 0) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } else { $stmt->execute([':contact_id' => $contact_id]); @@ -101,13 +101,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Object not pending transfer'); + sendEppError($conn, 2301, 'Object not pending transfer', $clTRID); return; } } elseif ($op === 'cancel') { // Only the requesting or 'Gaining' Registrar can cancel if ($clid === $registrar_id_contact) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -117,7 +117,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $stmt->execute([':contact_id' => $contact_id, ':authInfo_pw' => $authInfo_pw]); $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'Invalid authorization information'); + sendEppError($conn, 2202, 'Invalid authorization information', $clTRID); return; } } @@ -132,7 +132,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $stmt->execute([':contact_id' => $contact_id]); if ($stmt->errorCode() != 0) { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } else { $stmt->execute([':contact_id' => $contact_id]); @@ -166,7 +166,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Object not pending transfer'); + sendEppError($conn, 2301, 'Object not pending transfer', $clTRID); return; } } elseif ($op === 'query') { @@ -203,13 +203,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $xml = $epp->epp_writer($response); sendEppResponse($conn, $xml); } else { - sendEppError($conn, 2301, 'Object not pending transfer'); + sendEppError($conn, 2301, 'Object not pending transfer', $clTRID); return; } } elseif ($op === 'reject') { // Only the LOSING REGISTRAR can approve or reject if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -220,7 +220,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'Invalid authorization information'); + sendEppError($conn, 2202, 'Invalid authorization information', $clTRID); return; } } @@ -235,7 +235,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $updateStmt->execute([':contact_id' => $contact_id]); if ($updateStmt->errorCode() !== '00000') { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } else { $stmt = $db->prepare("SELECT `crid`, `crdate`, `upid`, `update`, `trdate`, `trstatus`, `reid`, `redate`, `acid`, `acdate` FROM `contact` WHERE `id` = :contact_id LIMIT 1"); @@ -271,7 +271,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Object not pending transfer'); + sendEppError($conn, 2301, 'Object not pending transfer', $clTRID); return; } } elseif ($op == 'request') { @@ -281,7 +281,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $days_from_registration = $stmt->fetchColumn(); if ($days_from_registration < 60) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -293,7 +293,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $days_from_last_transfer = $result['intval']; if ($last_trdate && $days_from_last_transfer < 60) { - sendEppError($conn, 2201, 'Authorization error'); + sendEppError($conn, 2201, 'Authorization error', $clTRID); return; } @@ -303,7 +303,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'Invalid authorization information'); + sendEppError($conn, 2202, 'Invalid authorization information', $clTRID); return; } @@ -313,13 +313,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { while ($status = $stmt->fetchColumn()) { if (preg_match("/.*(TransferProhibited)$/", $status) || preg_match("/^pending/", $status)) { - sendEppError($conn, 2304, 'Object status prohibits operation'); + sendEppError($conn, 2304, 'Object status prohibits operation', $clTRID); return; } } if ($clid == $registrar_id_contact) { - sendEppError($conn, 2106, 'Object is not eligible for transfer'); + sendEppError($conn, 2106, 'Object is not eligible for transfer', $clTRID); return; } @@ -338,7 +338,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { ]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'Command failed'); + sendEppError($conn, 2400, 'Command failed', $clTRID); return; } else { $stmt = $db->prepare("SELECT `crid`,`crdate`,`upid`,`update`,`trdate`,`trstatus`,`reid`,`redate`,`acid`,`acdate` FROM `contact` WHERE `id` = :contact_id LIMIT 1"); @@ -378,11 +378,11 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type) { sendEppResponse($conn, $xml); } } elseif ($op == 'pending') { - sendEppError($conn, 2300, 'Object pending transfer'); + sendEppError($conn, 2300, 'Object pending transfer', $clTRID); return; } } else { - sendEppError($conn, 2005, 'Parameter value syntax error'); + sendEppError($conn, 2005, 'Parameter value syntax error', $clTRID); return; } }