From 35e909000958a7b06792e27f873d0cbc9bb55012 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Sun, 27 Aug 2023 17:47:37 +0300 Subject: [PATCH] Added epp database log for error messages too - Fixed #14 --- epp/src/epp-check.php | 2 +- epp/src/epp-create.php | 192 +++++++++++++-------------- epp/src/epp-delete.php | 42 +++--- epp/src/epp-info.php | 24 ++-- epp/src/epp-renew.php | 22 ++-- epp/src/epp-transfer.php | 106 +++++++-------- epp/src/epp-update.php | 274 +++++++++++++++++++-------------------- epp/src/helpers.php | 10 +- epp/start.php | 50 +++---- 9 files changed, 363 insertions(+), 359 deletions(-) diff --git a/epp/src/epp-check.php b/epp/src/epp-check.php index 1cd2474..9fef6d2 100644 --- a/epp/src/epp-check.php +++ b/epp/src/epp-check.php @@ -65,7 +65,7 @@ function processHostCheck($conn, $db, $xml, $trans) { // 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host name', $clTRID, $trans); return; } diff --git a/epp/src/epp-create.php b/epp/src/epp-create.php index 338781b..d788a10 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, $trans) { $clTRID = (string) $xml->command->clTRID; if (!$contactID) { - sendEppError($conn, 2003, 'Identifier type minLength value=3, maxLength value=16', $clTRID); + sendEppError($conn, $db, 2003, 'Identifier type minLength value=3, maxLength value=16', $clTRID, $trans); return; } // Validation for contact ID $invalid_identifier = validate_identifier($contactID); if ($invalid_identifier) { - sendEppError($conn, 2005, 'Invalid contact ID', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact ID', $clTRID, $trans); return; } @@ -22,7 +22,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $contact = $stmt->fetch(PDO::FETCH_ASSOC); if ($contact) { - sendEppError($conn, 2302, 'Contact ID already exists', $clTRID); + sendEppError($conn, $db, 2302, 'Contact ID already exists', $clTRID, $trans); return; } @@ -65,64 +65,64 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $postalInfoIntCc = (string) $postalInfoInt->addr->cc; if (!$postalInfoIntName) { - sendEppError($conn, 2003, 'Missing contact:name', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:name', $clTRID, $trans); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntName)) { - sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:name', $clTRID, $trans); return; } if ($postalInfoIntOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:org', $clTRID, $trans); return; } } if ($postalInfoIntStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoIntStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoIntStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoIntCity)) { - sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:city', $clTRID, $trans); return; } if ($postalInfoIntSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoIntSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:sp', $clTRID, $trans); return; } } if ($postalInfoIntPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoIntPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoIntPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:pc', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:cc', $clTRID, $trans); return; } } @@ -148,70 +148,70 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $postalInfoLocCc = (string) $postalInfoLoc->addr->cc; if (!$postalInfoLocName) { - sendEppError($conn, 2003, 'Missing contact:name', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:name', $clTRID, $trans); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocName)) { - sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:name', $clTRID, $trans); return; } if ($postalInfoLocOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:org', $clTRID, $trans); return; } } if ($postalInfoLocStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoLocStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoLocStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoLocCity)) { - sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:city', $clTRID, $trans); return; } if ($postalInfoLocSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoLocSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:sp', $clTRID, $trans); return; } } if ($postalInfoLocPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoLocPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoLocPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:pc', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:cc', $clTRID, $trans); return; } } if (!$postalInfoInt && !$postalInfoLoc) { - sendEppError($conn, 2003, 'Missing contact:postalInfo', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:postalInfo', $clTRID, $trans); return; } @@ -220,7 +220,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $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})', $clTRID); + sendEppError($conn, $db, 2005, 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID, $trans); return; } @@ -230,34 +230,34 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $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})', $clTRID); + sendEppError($conn, $db, 2005, 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID, $trans); return; } $email = (string) $contactCreate->email; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - sendEppError($conn, 2005, 'Email address failed check', $clTRID); + sendEppError($conn, $db, 2005, 'Email address failed check', $clTRID, $trans); return; } $authInfo_pw = (string) $contactCreate->authInfo->pw; if (!$authInfo_pw) { - sendEppError($conn, 2003, 'Missing contact:pw', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:pw', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should have both upper and lower case characters', $clTRID); + sendEppError($conn, $db, 2005, 'Password should have both upper and lower case characters', $clTRID, $trans); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should contain one or more numbers', $clTRID); + sendEppError($conn, $db, 2005, 'Password should contain one or more numbers', $clTRID, $trans); return; } @@ -311,11 +311,11 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $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', $clTRID); + sendEppError($conn, $db, 2005, 'NIN should contain one or more numbers', $clTRID, $trans); return; } if (!in_array($nin_type, ['personal', 'business'])) { - sendEppError($conn, 2005, 'NIN type is invalid', $clTRID); + sendEppError($conn, $db, 2005, 'NIN type is invalid', $clTRID, $trans); return; } } @@ -370,7 +370,7 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) { $crdate = $stmt->fetchColumn(); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Contact could not be created due to database error', $clTRID); + sendEppError($conn, $db, 2400, 'Contact could not be created due to database error', $clTRID, $trans); return; } @@ -399,17 +399,17 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) { 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', $clTRID); + sendEppError($conn, $db, 2302, 'host:name already exists', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid host:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:name', $clTRID, $trans); return; } $host_addr_list = $xml->xpath('//addr'); if (count($host_addr_list) > 13) { - sendEppError($conn, 2306, 'No more than 13 host:addr are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 host:addr are allowed', $clTRID, $trans); return; } @@ -433,19 +433,19 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) { // v6 IP validation if ($addr_type === 'v6' && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - sendEppError($conn, 2005, 'Invalid host:addr v6', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:addr v6', $clTRID, $trans); return; } // v4 IP validation if ($addr_type !== 'v6' && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { - sendEppError($conn, 2005, 'Invalid host:addr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:addr v4', $clTRID, $trans); return; } // check for duplicate IPs if (isset($nsArr[$addr_type][$addr])) { - sendEppError($conn, 2306, 'Duplicated host:addr '.$addr, $clTRID); + sendEppError($conn, $db, 2306, 'Duplicated host:addr '.$addr, $clTRID, $trans); return; } @@ -480,12 +480,12 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type, $trans) { } if (!$domain_exist) { - sendEppError($conn, 2303, 'A host name object can NOT be created in a repository for which no superordinate domain name object exists', $clTRID); + sendEppError($conn, $db, 2303, 'A host name object can NOT be created in a repository for which no superordinate domain name object exists', $clTRID, $trans); return; } if ($clid != $clid_domain) { - sendEppError($conn, 2201, 'The domain name belongs to another registrar, you are not allowed to create hosts for it', $clTRID); + sendEppError($conn, $db, 2201, 'The domain name belongs to another registrar, you are not allowed to create hosts for it', $clTRID, $trans); return; } @@ -572,7 +572,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $invalid_domain = validate_label($domainName, $db); if ($invalid_domain) { - sendEppError($conn, 2306, 'Invalid domain:name', $clTRID); + sendEppError($conn, $db, 2306, 'Invalid domain:name', $clTRID, $trans); return; } @@ -588,7 +588,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { } if (!$valid_tld) { - sendEppError($conn, 2306, 'Invalid domain extension', $clTRID); + sendEppError($conn, $db, 2306, 'Invalid domain extension', $clTRID, $trans); return; } @@ -597,7 +597,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $domain_already_exist = $stmt->fetchColumn(); if ($domain_already_exist) { - sendEppError($conn, 2302, 'Domain name already exists', $clTRID); + sendEppError($conn, $db, 2302, 'Domain name already exists', $clTRID, $trans); return; } @@ -606,7 +606,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $domain_already_reserved = $stmt->fetchColumn(); if ($domain_already_reserved) { - sendEppError($conn, 2302, 'Domain name is reserved or restricted', $clTRID); + sendEppError($conn, $db, 2302, 'Domain name is reserved or restricted', $clTRID, $trans); return; } @@ -616,7 +616,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $period_unit = (string) $periodElement['unit']; if ($period && (($period < 1) || ($period > 99))) { - sendEppError($conn, 2004, 'domain:period minLength value=1, maxLength value=99', $clTRID); + sendEppError($conn, $db, 2004, 'domain:period minLength value=1, maxLength value=99', $clTRID, $trans); return; } elseif (!$period) { $period = 1; @@ -624,7 +624,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { if ($period_unit) { if (!preg_match('/^(m|y)$/', $period_unit)) { - sendEppError($conn, 2004, 'domain:period unit m|y', $clTRID); + sendEppError($conn, $db, 2004, 'domain:period unit m|y', $clTRID, $trans); return; } } else { @@ -639,7 +639,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { } if (!preg_match("/^(12|24|36|48|60|72|84|96|108|120)$/", $date_add)) { - sendEppError($conn, 2306, 'A domain name can initially be registered for 1-10 years period', $clTRID); + sendEppError($conn, $db, 2306, 'A domain name can initially be registered for 1-10 years period', $clTRID, $trans); return; } @@ -663,12 +663,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (!$price) { - sendEppError($conn, 2400, 'The price, period and currency for such TLD are not declared', $clTRID); + sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans); return; } if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'Low credit: minimum threshold reached', $clTRID); + sendEppError($conn, $db, 2104, 'Low credit: minimum threshold reached', $clTRID, $trans); return; } @@ -677,24 +677,24 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $hostAttr_list = $ns->xpath('//domain:hostAttr'); if (count($hostObj_list) > 0 && count($hostAttr_list) > 0) { - sendEppError($conn, 2001, 'It cannot be hostObj and hostAttr at the same time, either one or the other', $clTRID); + sendEppError($conn, $db, 2001, 'It cannot be hostObj and hostAttr at the same time, either one or the other', $clTRID, $trans); return; } if (count($hostObj_list) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID, $trans); return; } if (count($hostAttr_list) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostAttr are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostAttr are allowed', $clTRID, $trans); return; } $nsArr = []; foreach ($hostObj_list as $hostObj) { if (isset($nsArr[(string)$hostObj])) { - sendEppError($conn, 2302, 'Duplicate nameserver '.(string)$hostObj, $clTRID); + sendEppError($conn, $db, 2302, 'Duplicate nameserver '.(string)$hostObj, $clTRID, $trans); return; } $nsArr[(string)$hostObj] = 1; @@ -703,7 +703,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $nsArr = []; foreach ($ns->xpath('//domain:hostAttr/domain:hostName') as $hostName) { if (isset($nsArr[(string)$hostName])) { - sendEppError($conn, 2302, 'Duplicate nameserver '.(string)$hostName, $clTRID); + sendEppError($conn, $db, 2302, 'Duplicate nameserver '.(string)$hostName, $clTRID, $trans); return; } $nsArr[(string)$hostName] = 1; @@ -714,7 +714,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $hostObj = strtoupper((string)$node); if (preg_match("/[^A-Z0-9\.\-]/", $hostObj) || preg_match("/^-|^\.|-\.|\.-|\.\.|-$|\.$/", $hostObj)) { - sendEppError($conn, 2005, 'Invalid domain:hostObj', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostObj', $clTRID, $trans); return; } @@ -727,11 +727,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $host_id_already_exist = $stmt->fetch(PDO::FETCH_COLUMN); if (!$host_id_already_exist) { - sendEppError($conn, 2303, 'domain:hostObj '.$hostObj.' does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'domain:hostObj '.$hostObj.' does not exist', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid domain:hostObj', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostObj', $clTRID, $trans); return; } } @@ -742,7 +742,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $hostName = strtoupper((string)$node->xpath('//domain:hostName')[0]); if (preg_match("/[^A-Z0-9\.\-]/", $hostName) || preg_match("/^-|^\.-|-\.$|^\.$/", $hostName)) { - sendEppError($conn, 2005, 'Invalid domain:hostName', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostName', $clTRID, $trans); return; } @@ -764,7 +764,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $hostAddrNodes = $node->xpath('//domain:hostAddr'); if (count($hostAddrNodes) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID, $trans); return; } @@ -772,14 +772,14 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostAddrNodes as $hostAddrNode) { $hostAddr = (string)$hostAddrNode; if (isset($nsArr[$hostAddr])) { - sendEppError($conn, 2302, 'Duplicate IP'.$hostAddr, $clTRID); + sendEppError($conn, $db, 2302, 'Duplicate IP'.$hostAddr, $clTRID, $trans); return; } $nsArr[$hostAddr] = true; } if (count($hostAddrNodes) === 0) { - sendEppError($conn, 2003, 'Missing domain:hostAddr', $clTRID); + sendEppError($conn, $db, 2003, 'Missing domain:hostAddr', $clTRID, $trans); return; } @@ -801,7 +801,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // true // Additional verifications for reserved or private IPs as per [RFC5735] [RFC5156] can go here. } else { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v6', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v6', $clTRID, $trans); return; } } else { @@ -810,11 +810,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // true // Additional verifications for reserved or private IPs as per [RFC5735] [RFC5156] can go here. if ($hostAddr == '127.0.0.1') { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v4', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v4', $clTRID, $trans); return; } } @@ -840,17 +840,17 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Object does not exist error if (!$domain_exist) { - sendEppError($conn, 2303, 'domain:hostName '.$hostName.' . A host name object can NOT be created in a repository for which no superordinate domain name object exists', $clTRID); + sendEppError($conn, $db, 2303, 'domain:hostName '.$hostName.' . A host name object can NOT be created in a repository for which no superordinate domain name object exists', $clTRID, $trans); return; } // Authorization error if ($clid != $clid_domain) { - sendEppError($conn, 2201, 'The domain name belongs to another registrar, you are not allowed to create hosts for it', $clTRID); + sendEppError($conn, $db, 2201, 'The domain name belongs to another registrar, you are not allowed to create hosts for it', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid domain:hostName', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostName', $clTRID, $trans); return; } @@ -858,7 +858,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Max 13 IP per host if (count($hostAddr_list) > 13) { - sendEppError($conn, 2306, 'No more than 13 IPs are allowed per host', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 IPs are allowed per host', $clTRID, $trans); return; } @@ -867,7 +867,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostAddr_list as $node) { $hostAddr = (string) $node; if (isset($nsArr[$hostAddr])) { - sendEppError($conn, 2302, 'Duplicate IP'.$hostAddr, $clTRID); + sendEppError($conn, $db, 2302, 'Duplicate IP'.$hostAddr, $clTRID, $trans); return; } $nsArr[$hostAddr] = 1; @@ -875,7 +875,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Check for missing host addresses if (count($hostAddr_list) === 0) { - sendEppError($conn, 2003, 'Missing domain:hostAddr', $clTRID); + sendEppError($conn, $db, 2003, 'Missing domain:hostAddr', $clTRID, $trans); return; } @@ -898,7 +898,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // true // Add check for reserved or private IP addresses (not implemented here, add as needed) } else { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v6', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v6', $clTRID, $trans); return; } } else { @@ -909,11 +909,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // true // Add check for reserved or private IP addresses (not implemented here, add as needed) if ($hostAddr === '127.0.0.1') { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v4', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v4', $clTRID, $trans); return; } } @@ -924,7 +924,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { 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, 'Invalid domain:hostName', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostName', $clTRID, $trans); return; } } @@ -944,12 +944,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { - sendEppError($conn, 2303, 'domain:registrant does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'domain:registrant does not exist', $clTRID, $trans); return; } if ($clid != $row['clid']) { - sendEppError($conn, 2201, 'The contact requested in the command does NOT belong to the current registrar', $clTRID); + sendEppError($conn, $db, 2201, 'The contact requested in the command does NOT belong to the current registrar', $clTRID, $trans); return; } } @@ -961,7 +961,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Max five contacts per domain name for each type if ($size > 5) { - sendEppError($conn, 2306, 'No more than 5 '.$type.' contacts are allowed per domain name', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 5 '.$type.' contacts are allowed per domain name', $clTRID, $trans); return; } @@ -975,12 +975,12 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { - sendEppError($conn, 2303, 'domain:contact '.$type.' does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'domain:contact '.$type.' does not exist', $clTRID, $trans); return; } if ($clid != $row['clid']) { - sendEppError($conn, 2201, 'The contact type='.$type.' requested in the command does NOT belong to the current Registrar', $clTRID); + sendEppError($conn, $db, 2201, 'The contact type='.$type.' requested in the command does NOT belong to the current Registrar', $clTRID, $trans); return; } } @@ -989,22 +989,22 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { $authInfo_pw = $xml->xpath('//domain:authInfo/domain:pw[1]')[0] ?? null; if (!$authInfo_pw) { - sendEppError($conn, 2003, 'Missing domain:pw', $clTRID); + sendEppError($conn, $db, 2003, 'Missing domain:pw', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should have both upper and lower case characters', $clTRID); + sendEppError($conn, $db, 2005, 'Password should have both upper and lower case characters', $clTRID, $trans); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should contain one or more numbers', $clTRID); + sendEppError($conn, $db, 2005, 'Password should contain one or more numbers', $clTRID, $trans); return; } @@ -1049,24 +1049,24 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Data sanity checks // Validate keyTag if (!isset($keyTag) || !is_int($keyTag)) { - sendEppError($conn, 2005, 'Incomplete keyTag provided', $clTRID); + sendEppError($conn, $db, 2005, 'Incomplete keyTag provided', $clTRID, $trans); return; } if ($keyTag < 0 || $keyTag > 65535) { - sendEppError($conn, 2006, 'Invalid keyTag provided', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid keyTag provided', $clTRID, $trans); return; } // Validate alg $validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16]; if (!isset($alg) || !in_array($alg, $validAlgorithms)) { - sendEppError($conn, 2006, 'Invalid algorithm', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid algorithm', $clTRID, $trans); return; } // Validate digestType and digest if (!isset($digestType) || !is_int($digestType)) { - sendEppError($conn, 2005, 'Invalid digestType', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid digestType', $clTRID, $trans); return; } $validDigests = [ @@ -1075,11 +1075,11 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { 4 => 96 // SHA-384 ]; if (!isset($validDigests[$digestType])) { - sendEppError($conn, 2006, 'Unsupported digestType', $clTRID); + sendEppError($conn, $db, 2006, 'Unsupported digestType', $clTRID, $trans); return; } if (!isset($digest) || strlen($digest) != $validDigests[$digestType] || !ctype_xdigit($digest)) { - sendEppError($conn, 2006, 'Invalid digest length or format', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid digest length or format', $clTRID, $trans); return; } @@ -1099,25 +1099,25 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { // Validate flags $validFlags = [256, 257]; if (isset($flags) && !in_array($flags, $validFlags)) { - sendEppError($conn, 2005, 'Invalid flags', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid flags', $clTRID, $trans); return; } // Validate protocol if (isset($protocol) && $protocol != 3) { - sendEppError($conn, 2006, 'Invalid protocol', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid protocol', $clTRID, $trans); return; } // Validate algKeyData if (isset($algKeyData)) { - sendEppError($conn, 2005, 'Invalid algKeyData encoding', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid algKeyData encoding', $clTRID, $trans); return; } // Validate pubKey if (isset($pubKey) && base64_encode(base64_decode($pubKey, true)) !== $pubKey) { - sendEppError($conn, 2005, 'Invalid pubKey encoding', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid pubKey encoding', $clTRID, $trans); return; } } @@ -1307,7 +1307,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) { } catch (Exception $e) { $db->rollBack(); - sendEppError($conn, 2400, "Database failure: " . $e->getMessage(), $clTRID); + sendEppError($conn, $db, 2400, "Database failure: " . $e->getMessage(), $clTRID, $trans); } $svTRID = generateSvTRID(); $response = [ diff --git a/epp/src/epp-delete.php b/epp/src/epp-delete.php index d3d27d8..472f5cb 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, $trans) { $clTRID = (string) $xml->command->clTRID; if (!$contactID) { - sendEppError($conn, 2003, 'Missing contact:id', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:id', $clTRID, $trans); return; } @@ -17,7 +17,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { $registrar_id_contact = $row['clid'] ?? null; if (!$contact_id) { - sendEppError($conn, 2303, 'contact:id does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'contact:id does not exist', $clTRID, $trans); return; } @@ -28,7 +28,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Contact belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'Contact belongs to another registrar', $clTRID, $trans); return; } @@ -37,7 +37,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { $registrantExists = $stmt->fetchColumn(); if ($registrantExists) { - sendEppError($conn, 2305, 'This contact is associated with a domain as a registrant', $clTRID); + sendEppError($conn, $db, 2305, 'This contact is associated with a domain as a registrant', $clTRID, $trans); return; } @@ -46,7 +46,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { $contactInUse = $stmt->fetchColumn(); if ($contactInUse) { - sendEppError($conn, 2305, 'This contact is associated with a domain', $clTRID); + sendEppError($conn, $db, 2305, 'This contact is associated with a domain', $clTRID, $trans); return; } @@ -55,7 +55,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { while ($status = $stmt->fetchColumn()) { if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'It has a status that does not allow deletion', $clTRID); + sendEppError($conn, $db, 2304, 'It has a status that does not allow deletion', $clTRID, $trans); return; } } @@ -69,7 +69,7 @@ function processContactDelete($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$contact_id]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'Contact was not deleted, it probably has links to other objects', $clTRID); + sendEppError($conn, $db, 2400, 'Contact was not deleted, it probably has links to other objects', $clTRID, $trans); return; } @@ -94,7 +94,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) { $clTRID = (string) $xml->command->clTRID; if (!$hostName) { - sendEppError($conn, 2003, 'Specify your host name', $clTRID); + sendEppError($conn, $db, 2003, 'Specify your host name', $clTRID, $trans); return; } @@ -107,7 +107,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) { $registrar_id_host = $result['clid'] ?? null; if (!$host_id) { - sendEppError($conn, 2303, 'host:name does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'host:name does not exist', $clTRID, $trans); return; } @@ -118,7 +118,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid !== $registrar_id_host) { - sendEppError($conn, 2201, 'Host belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'Host belongs to another registrar', $clTRID, $trans); return; } @@ -128,7 +128,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) { $nameserver_inuse = $stmt->fetchColumn(); if ($nameserver_inuse) { - sendEppError($conn, 2305, 'It is not possible to delete because it is a dependency, it is used by some domain', $clTRID); + sendEppError($conn, $db, 2305, 'It is not possible to delete because it is a dependency, it is used by some domain', $clTRID, $trans); return; } @@ -145,7 +145,7 @@ function processHostDelete($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([':host_id' => $host_id]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'The host was not deleted, it depends on other objects', $clTRID); + sendEppError($conn, $db, 2400, 'The host was not deleted, it depends on other objects', $clTRID, $trans); return; } @@ -170,7 +170,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $clTRID = (string) $xml->command->clTRID; if (!$domainName) { - sendEppError($conn, 2003, 'Please specify the domain name that will be deleted', $clTRID); + sendEppError($conn, $db, 2003, 'Please specify the domain name that will be deleted', $clTRID, $trans); return; } @@ -184,7 +184,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $result = $stmt->fetch(PDO::FETCH_ASSOC); if (!$result) { - sendEppError($conn, 2303, 'domain:name does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'domain:name does not exist', $clTRID, $trans); return; } @@ -217,7 +217,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid != $registrar_id_domain) { - sendEppError($conn, 2201, 'Domain belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'Domain belongs to another registrar', $clTRID, $trans); return; } @@ -226,7 +226,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $status = $row['status']; if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'The domain name has a status that does not allow deletion', $clTRID); + sendEppError($conn, $db, 2304, 'The domain name has a status that does not allow deletion', $clTRID, $trans); return; } } @@ -257,7 +257,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'The price, period and currency for such TLD are not declared', $clTRID); + sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans); return; } @@ -291,7 +291,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$domain_id]); if ($stmt->errorCode() != "00000") { - sendEppError($conn, 2400, 'The domain name has not been deleted, it has something to do with other objects', $clTRID); + sendEppError($conn, $db, 2400, 'The domain name has not been deleted, it has something to do with other objects', $clTRID, $trans); return; } @@ -315,7 +315,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'The price, period and currency for such TLD are not declared', $clTRID); + sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans); return; } @@ -339,7 +339,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'The price, period and currency for such TLD are not declared', $clTRID); + sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans); return; } @@ -365,7 +365,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (!isset($price)) { - sendEppError($conn, 2400, 'The price, period and currency for such TLD are not declared', $clTRID); + sendEppError($conn, $db, 2400, 'The price, period and currency for such TLD are not declared', $clTRID, $trans); return; } diff --git a/epp/src/epp-info.php b/epp/src/epp-info.php index 2543378..4292208 100644 --- a/epp/src/epp-info.php +++ b/epp/src/epp-info.php @@ -7,7 +7,7 @@ function processContactInfo($conn, $db, $xml, $trans) { // Validation for contact ID $invalid_identifier = validate_identifier($contactID); if ($invalid_identifier) { - sendEppError($conn, 2005, 'Invalid contact ID', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact ID', $clTRID, $trans); return; } @@ -18,7 +18,7 @@ function processContactInfo($conn, $db, $xml, $trans) { $contact = $stmt->fetch(PDO::FETCH_ASSOC); if (!$contact) { - sendEppError($conn, 2303, 'Contact does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Contact does not exist', $clTRID, $trans); return; } @@ -86,7 +86,7 @@ function processContactInfo($conn, $db, $xml, $trans) { sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); } } @@ -96,7 +96,7 @@ function processHostInfo($conn, $db, $xml, $trans) { // 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host name', $clTRID, $trans); return; } @@ -107,7 +107,7 @@ function processHostInfo($conn, $db, $xml, $trans) { $host = $stmt->fetch(PDO::FETCH_ASSOC); if (!$host) { - sendEppError($conn, 2303, 'Host does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Host does not exist', $clTRID, $trans); return; } @@ -164,7 +164,7 @@ function processHostInfo($conn, $db, $xml, $trans) { updateTransaction($db, 'info', 'host', 'H_'.$host['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); } } @@ -175,12 +175,12 @@ function processDomainInfo($conn, $db, $xml, $trans) { // Validation for domain name $invalid_label = validate_label($domainName, $db); if ($invalid_label) { - sendEppError($conn, 2005, 'Invalid domain name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain name', $clTRID, $trans); return; } if (!filter_var($domainName, FILTER_VALIDATE_DOMAIN)) { - sendEppError($conn, 2005, 'Invalid domain name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain name', $clTRID, $trans); return; } @@ -191,7 +191,7 @@ function processDomainInfo($conn, $db, $xml, $trans) { $domain = $stmt->fetch(PDO::FETCH_ASSOC); if (!$domain) { - sendEppError($conn, 2303, 'Domain does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Domain does not exist', $clTRID, $trans); return; } @@ -331,7 +331,7 @@ function processDomainInfo($conn, $db, $xml, $trans) { updateTransaction($db, 'info', 'domain', 'D_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); } } @@ -349,7 +349,7 @@ function processFundsInfo($conn, $db, $xml, $clid, $trans) { $availableCredit = number_format($availableCredit, 2, '.', ''); if (!$funds) { - sendEppError($conn, 2303, 'Registrar does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Registrar does not exist', $clTRID, $trans); return; } @@ -374,6 +374,6 @@ function processFundsInfo($conn, $db, $xml, $clid, $trans) { sendEppResponse($conn, $xml); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); } } \ No newline at end of file diff --git a/epp/src/epp-renew.php b/epp/src/epp-renew.php index 7372eb2..9a0f4a7 100644 --- a/epp/src/epp-renew.php +++ b/epp/src/epp-renew.php @@ -10,20 +10,20 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { $clTRID = (string) $xml->command->clTRID; if (!$domainName) { - sendEppError($conn, 2003, 'Pleae provide domain name', $clTRID); + sendEppError($conn, $db, 2003, 'Please provide domain name', $clTRID, $trans); return; } if ($period) { if ($period < 1 || $period > 99) { - sendEppError($conn, 2004, "domain:period minLength value='1', maxLength value='99'"); + sendEppError($conn, $db, 2004, "domain:period minLength value='1', maxLength value='99'"); return; } } if ($periodUnit) { if (!preg_match("/^(m|y)$/", $periodUnit)) { - sendEppError($conn, 2004, "domain:period unit m|y"); + sendEppError($conn, $db, 2004, "domain:period unit m|y"); return; } } @@ -39,12 +39,12 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { $domainData = $stmt->fetch(PDO::FETCH_ASSOC); if (!$domainData) { - sendEppError($conn, 2303, 'Domain does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Domain does not exist', $clTRID, $trans); return; } if ($clid['id'] != $domainData['clid']) { - sendEppError($conn, 2201, 'It belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'It belongs to another registrar', $clTRID, $trans); return; } @@ -56,7 +56,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $status = $row['status']; if (preg_match('/.*(RenewProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'It has a status that does not allow renew, first change the status', $clTRID); + sendEppError($conn, $db, 2304, 'It has a status that does not allow renew, first change the status', $clTRID, $trans); return; } } @@ -64,7 +64,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { $expiration_date = explode(" ", $domainData['exdate'])[0]; // remove time, keep only date if ($curExpDate !== $expiration_date) { - sendEppError($conn, 2306, 'The expiration date does not match', $clTRID); + sendEppError($conn, $db, 2306, 'The expiration date does not match', $clTRID, $trans); return; } @@ -78,7 +78,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { 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, 'Not less than 1 year and not more than 10', $clTRID); + sendEppError($conn, $db, 2306, 'Not less than 1 year and not more than 10', $clTRID, $trans); return; } @@ -91,7 +91,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { // 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, 'Domains can be renewed at any time, but the expire date cannot be more than 10 years in the future', $clTRID); + sendEppError($conn, $db, 2306, 'Domains can be renewed at any time, but the expire date cannot be more than 10 years in the future', $clTRID, $trans); return; } @@ -110,7 +110,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { $price = $stmt->fetchColumn(); if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'There is no money on the account to renew', $clTRID); + sendEppError($conn, $db, 2104, 'There is no money on the account to renew', $clTRID, $trans); return; } @@ -130,7 +130,7 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) { // Error check $errorInfo = $stmt->errorInfo(); if (isset($errorInfo[2])) { - sendEppError($conn, 2400, 'It was not renewed successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'It was not renewed successfully, something is wrong', $clTRID, $trans); return; } else { // Update registrar's account balance: diff --git a/epp/src/epp-transfer.php b/epp/src/epp-transfer.php index 7f7c81c..832af9e 100644 --- a/epp/src/epp-transfer.php +++ b/epp/src/epp-transfer.php @@ -12,7 +12,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $authInfo_pw = (string)$obj->xpath('//contact:authInfo/contact:pw[1]')[0]; if (!$contactID) { - sendEppError($conn, 2003, 'Contact ID was not provided', $clTRID); + sendEppError($conn, $db, 2003, 'Contact ID was not provided', $clTRID, $trans); return; } @@ -24,7 +24,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $registrar_id_contact = $result['clid'] ?? null; if (!$contact_id) { - sendEppError($conn, 2303, 'Contact does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Contact does not exist', $clTRID, $trans); return; } @@ -36,7 +36,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) if ($op === 'approve') { if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Only the losing registrar can approve', $clTRID); + sendEppError($conn, $db, 2201, 'Only the losing registrar can approve', $clTRID, $trans); return; } @@ -49,7 +49,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -68,7 +68,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) ]); if ($stmt->errorCode() != 0) { - sendEppError($conn, 2400, 'The transfer was not approved successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not approved successfully, something is wrong', $clTRID, $trans); return; } else { $stmt->execute([':contact_id' => $contact_id]); @@ -104,13 +104,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op === 'cancel') { // Only the requesting or 'Gaining' Registrar can cancel if ($clid === $registrar_id_contact) { - sendEppError($conn, 2201, 'Only the applicant can cancel', $clTRID); + sendEppError($conn, $db, 2201, 'Only the applicant can cancel', $clTRID, $trans); return; } @@ -120,7 +120,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute([':contact_id' => $contact_id, ':authInfo_pw' => $authInfo_pw]); $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -135,7 +135,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute([':contact_id' => $contact_id]); if ($stmt->errorCode() != 0) { - sendEppError($conn, 2400, 'The transfer was not canceled successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not canceled successfully, something is wrong', $clTRID, $trans); return; } else { $stmt->execute([':contact_id' => $contact_id]); @@ -171,7 +171,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op === 'query') { @@ -210,13 +210,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) updateTransaction($db, 'transfer', 'contact', $identifier, 1000, 'Command completed successfully', $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } else { - sendEppError($conn, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op === 'reject') { // Only the LOSING REGISTRAR can approve or reject if ($clid !== $registrar_id_contact) { - sendEppError($conn, 2201, 'Only the losing registrar can reject', $clTRID); + sendEppError($conn, $db, 2201, 'Only the losing registrar can reject', $clTRID, $trans); return; } @@ -227,7 +227,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -242,7 +242,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $updateStmt->execute([':contact_id' => $contact_id]); if ($updateStmt->errorCode() !== '00000') { - sendEppError($conn, 2400, 'The transfer was not successfully rejected, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not successfully rejected, something is wrong', $clTRID, $trans); return; } else { $stmt = $db->prepare("SELECT `crid`, `crdate`, `upid`, `update`, `trdate`, `trstatus`, `reid`, `redate`, `acid`, `acdate` FROM `contact` WHERE `id` = :contact_id LIMIT 1"); @@ -280,7 +280,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'Command failed because the contact is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op == 'request') { @@ -290,7 +290,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $days_from_registration = $stmt->fetchColumn(); if ($days_from_registration < 60) { - sendEppError($conn, 2201, 'The contact name must not be within 60 days of its initial registration', $clTRID); + sendEppError($conn, $db, 2201, 'The contact name must not be within 60 days of its initial registration', $clTRID, $trans); return; } @@ -302,7 +302,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $days_from_last_transfer = $result['intval']; if ($last_trdate && $days_from_last_transfer < 60) { - sendEppError($conn, 2201, 'The contact name must not be within 60 days of its last transfer from another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'The contact name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans); return; } @@ -312,7 +312,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) $contact_authinfo_id = $stmt->fetchColumn(); if (!$contact_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } @@ -322,13 +322,13 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) while ($status = $stmt->fetchColumn()) { if (preg_match("/.*(TransferProhibited)$/", $status) || preg_match("/^pending/", $status)) { - sendEppError($conn, 2304, 'It has a status that does not allow the transfer, first change the status', $clTRID); + sendEppError($conn, $db, 2304, 'It has a status that does not allow the transfer, first change the status', $clTRID, $trans); return; } } if ($clid == $registrar_id_contact) { - sendEppError($conn, 2106, 'Destination client of the transfer operation is the contact sponsoring client', $clTRID); + sendEppError($conn, $db, 2106, 'Destination client of the transfer operation is the contact sponsoring client', $clTRID, $trans); return; } @@ -347,7 +347,7 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) ]); if ($stmt->errorCode() != '00000') { - sendEppError($conn, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID, $trans); return; } else { $stmt = $db->prepare("SELECT `crid`,`crdate`,`upid`,`update`,`trdate`,`trstatus`,`reid`,`redate`,`acid`,`acdate` FROM `contact` WHERE `id` = :contact_id LIMIT 1"); @@ -389,11 +389,11 @@ function processContactTranfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } elseif ($op == 'pending') { - sendEppError($conn, 2300, 'Command failed because the contact is pending transfer', $clTRID); + sendEppError($conn, $db, 2300, 'Command failed because the contact is pending transfer', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Only op: approve|cancel|query|reject|request are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only op: approve|cancel|query|reject|request are accepted', $clTRID, $trans); return; } } @@ -408,7 +408,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $authInfo_pw = (string)$xml->xpath('//domain:authInfo/domain:pw[1]')[0]; if (!$domainName) { - sendEppError($conn, 2003, 'Please provide the domain name', $clTRID); + sendEppError($conn, $db, 2003, 'Please provide the domain name', $clTRID, $trans); return; } @@ -422,7 +422,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $registrar_id_domain = $row['clid'] ?? null; if (!$domain_id) { - sendEppError($conn, 2303, 'Domain does not exist in registry', $clTRID); + sendEppError($conn, $db, 2303, 'Domain does not exist in registry', $clTRID, $trans); return; } @@ -434,7 +434,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) if ($op === 'approve') { if ($clid !== $registrar_id_domain) { - sendEppError($conn, 2201, 'Only LOSING REGISTRAR can approve', $clTRID); + sendEppError($conn, $db, 2201, 'Only LOSING REGISTRAR can approve', $clTRID, $trans); return; } @@ -444,7 +444,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $domain_authinfo_id = $stmt->fetchColumn(); if (!$domain_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -471,7 +471,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $price = $stmt->fetchColumn(); if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'The registrar who took over this domain has no money to pay the renewal period that resulted from the transfer request', $clTRID); + sendEppError($conn, $db, 2104, 'The registrar who took over this domain has no money to pay the renewal period that resulted from the transfer request', $clTRID, $trans); return; } } @@ -483,7 +483,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute([$row["reid"], $clid, $domain_id]); if ($stmt->errorCode() !== PDO::ERR_NONE) { - sendEppError($conn, 2400, 'The transfer was not successful, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not successful, something is wrong', $clTRID, $trans); return; } else { $stmt = $db->prepare("UPDATE `registrar` SET `accountBalance` = (`accountBalance` - :price) WHERE `id` = :reid"); @@ -551,14 +551,14 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'The domain is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'The domain is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op === 'cancel') { if ($clid === $registrar_id_domain) { - sendEppError($conn, 2201, 'Only the APPLICANT can cancel', $clTRID); + sendEppError($conn, $db, 2201, 'Only the APPLICANT can cancel', $clTRID, $trans); return; } @@ -568,7 +568,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $domain_authinfo_id = $stmt->fetchColumn(); if (!$domain_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -583,7 +583,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute(['domain_id' => $domain_id]); if ($stmt->errorCode() !== '00000') { - sendEppError($conn, 2400, 'The transfer was not canceled successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not canceled successfully, something is wrong', $clTRID, $trans); return; } else { $stmt = $db->prepare("SELECT `id`, `registrant`, `crdate`, `exdate`, `update`, `clid`, `crid`, `upid`, `trdate`, `trstatus`, `reid`, `redate`, `acid`, `acdate`, `transfer_exdate` FROM `domain` WHERE `name` = :name LIMIT 1"); @@ -625,7 +625,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'The domain is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'The domain is NOT pending transfer', $clTRID, $trans); return; } } @@ -672,14 +672,14 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) updateTransaction($db, 'transfer', 'domain', $domainName, 1000, 'Command completed successfully', $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } else { - sendEppError($conn, 2301, 'The domain is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'The domain is NOT pending transfer', $clTRID, $trans); return; } } elseif ($op === 'reject') { if ($clid !== $registrar_id_domain) { - sendEppError($conn, 2201, 'Only LOSING REGISTRAR can reject', $clTRID); + sendEppError($conn, $db, 2201, 'Only LOSING REGISTRAR can reject', $clTRID, $trans); return; } @@ -689,7 +689,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $domain_authinfo_id = $stmtAuthInfo->fetchColumn(); if (!$domain_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is not correct', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans); return; } } @@ -704,7 +704,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $success = $stmtUpdate->execute(['domain_id' => $domain_id]); if (!$success || $stmtUpdate->errorCode() !== '00000') { - sendEppError($conn, 2400, 'The transfer was not successfully rejected, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not successfully rejected, something is wrong', $clTRID, $trans); return; } else { $stmtReID = $db->prepare("SELECT `clid` FROM `registrar` WHERE `id` = :reid LIMIT 1"); @@ -741,7 +741,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) sendEppResponse($conn, $xml); } } else { - sendEppError($conn, 2301, 'The domain is NOT pending transfer', $clTRID); + sendEppError($conn, $db, 2301, 'The domain is NOT pending transfer', $clTRID, $trans); return; } } @@ -753,7 +753,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $days_from_registration = $stmt->fetchColumn(); if ($days_from_registration < 60) { - sendEppError($conn, 2201, 'The domain name must not be within 60 days of its initial registration', $clTRID); + sendEppError($conn, $db, 2201, 'The domain name must not be within 60 days of its initial registration', $clTRID, $trans); return; } @@ -765,7 +765,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $days_from_last_transfer = $result["intval"]; if ($last_trdate && $days_from_last_transfer < 60) { - sendEppError($conn, 2201, 'The domain name must not be within 60 days of its last transfer from another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'The domain name must not be within 60 days of its last transfer from another registrar', $clTRID, $trans); return; } @@ -775,7 +775,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $days_from_expiry_date = $stmt->fetchColumn(); if ($days_from_expiry_date > 30) { - sendEppError($conn, 2201, 'The domain name must not be more than 30 days past its expiry date', $clTRID); + sendEppError($conn, $db, 2201, 'The domain name must not be more than 30 days past its expiry date', $clTRID, $trans); return; } @@ -785,7 +785,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $domain_authinfo_id = $stmt->fetchColumn(); if (!$domain_authinfo_id) { - sendEppError($conn, 2202, 'authInfo pw is invalid', $clTRID); + sendEppError($conn, $db, 2202, 'authInfo pw is invalid', $clTRID, $trans); return; } @@ -794,13 +794,13 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute(['domain_id' => $domain_id]); while ($status = $stmt->fetchColumn()) { if (preg_match('/.*(TransferProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'It has a status that does not allow the transfer', $clTRID); + sendEppError($conn, $db, 2304, 'It has a status that does not allow the transfer', $clTRID, $trans); return; } } if ($clid == $registrar_id_domain) { - sendEppError($conn, 2106, 'Destination client of the transfer operation is the domain sponsoring client', $clTRID); + sendEppError($conn, $db, 2106, 'Destination client of the transfer operation is the domain sponsoring client', $clTRID, $trans); return; } @@ -829,14 +829,14 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) if ($period) { if ($period < 1 || $period > 99) { - sendEppError($conn, 2004, "domain:period minLength value='1', maxLength value='99'", $clTRID); + sendEppError($conn, $db, 2004, "domain:period minLength value='1', maxLength value='99'", $clTRID, $trans); return; } } if ($period_unit) { if (!in_array($period_unit, ['m', 'y'])) { - sendEppError($conn, 2004, 'domain:period unit m|y', $clTRID); + sendEppError($conn, $db, 2004, 'domain:period unit m|y', $clTRID, $trans); return; } } @@ -851,7 +851,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) if ($date_add > 0) { if (!preg_match("/^(12|24|36|48|60|72|84|96|108|120)$/", $date_add)) { - sendEppError($conn, 2306, 'Not less than 1 year and not more than 10', $clTRID); + sendEppError($conn, $db, 2306, 'Not less than 1 year and not more than 10', $clTRID, $trans); return; } @@ -867,7 +867,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $price = $result["m$date_add"]; if (($registrar_balance + $creditLimit) < $price) { - sendEppError($conn, 2104, 'The registrar who wants to take over this domain has no money', $clTRID); + sendEppError($conn, $db, 2104, 'The registrar who wants to take over this domain has no money', $clTRID, $trans); return; } @@ -876,7 +876,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) $stmt->execute([':registrar_id' => $clid, ':registrar_id_domain' => $registrar_id_domain, ':domain_id' => $domain_id]); if ($stmt->errorCode() !== '00000') { - sendEppError($conn, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID, $trans); return; } else { // Get the domain details @@ -944,7 +944,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) ]); if ($stmt->errorCode() !== '00000') { - sendEppError($conn, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'The transfer was not initiated successfully, something is wrong', $clTRID, $trans); return; } else { // Get the domain details @@ -999,12 +999,12 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans) } } } elseif ($trstatus === 'pending') { - sendEppError($conn, 2300, 'Command failed as the domain is pending transfer', $clTRID); + sendEppError($conn, $db, 2300, 'Command failed as the domain is pending transfer', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Only op: approve|cancel|query|reject|request are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only op: approve|cancel|query|reject|request are accepted', $clTRID, $trans); return; } } \ No newline at end of file diff --git a/epp/src/epp-update.php b/epp/src/epp-update.php index 987676f..79eb40b 100644 --- a/epp/src/epp-update.php +++ b/epp/src/epp-update.php @@ -10,12 +10,12 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $identicaUpdate = $xml->xpath('//identica:update') ?? null; if (!$contactRem && !$contactAdd && !$contactChg && !$identicaUpdate) { - sendEppError($conn, 2003, 'At least one contact:rem || contact:add || contact:chg', $clTRID); + sendEppError($conn, $db, 2003, 'At least one contact:rem || contact:add || contact:chg', $clTRID, $trans); return; } if (!$contactID) { - sendEppError($conn, 2003, 'Contact identifier missing', $clTRID); + sendEppError($conn, $db, 2003, 'Contact identifier missing', $clTRID, $trans); return; } @@ -26,7 +26,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $registrar_id_contact = $row['clid'] ?? null; if (!$contact_id) { - sendEppError($conn, 2303, 'Contact does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Contact does not exist', $clTRID, $trans); return; } @@ -37,7 +37,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid != $registrar_id_contact) { - sendEppError($conn, 2201, 'It belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'It belongs to another registrar', $clTRID, $trans); return; } @@ -46,7 +46,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { while ($statusRow = $stmt->fetch(PDO::FETCH_ASSOC)) { $status = $statusRow['status']; if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification', $clTRID); + sendEppError($conn, $db, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification', $clTRID, $trans); return; } } @@ -60,7 +60,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $statusList = $xml->xpath('//contact:status/@s', $contactRem); if (count($statusList) == 0) { - sendEppError($conn, 2005, 'At least one status element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one status element MUST be present', $clTRID, $trans); return; } @@ -70,14 +70,14 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clientUpdateProhibited = 0; } if (!preg_match('/^(clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited)$/', $status)) { - sendEppError($conn, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID, $trans); return; } } } if ($clientUpdateProhibited) { - sendEppError($conn, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID); + sendEppError($conn, $db, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID, $trans); return; } @@ -85,14 +85,14 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $statusList = $xml->xpath('//contact:status/@s', $contactAdd); if (count($statusList) == 0) { - sendEppError($conn, 2005, 'At least one status element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one status element MUST be present', $clTRID, $trans); return; } foreach ($statusList as $node) { $status = (string)$node; if (!preg_match('/^(clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited)$/', $status)) { - sendEppError($conn, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID, $trans); return; } @@ -102,7 +102,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $contactStatusId = $stmt->fetchColumn(); if ($contactStatusId) { - sendEppError($conn, 2306, 'This status '.$status.' already exists for this contact', $clTRID); + sendEppError($conn, $db, 2306, 'This status '.$status.' already exists for this contact', $clTRID, $trans); return; } } @@ -150,64 +150,64 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $postalInfoIntCc = (string) $postalInfoInt->children('urn:ietf:params:xml:ns:contact-1.0')->addr->cc; if (!$postalInfoIntName) { - sendEppError($conn, 2003, 'Missing contact:name', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:name', $clTRID, $trans); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntName)) { - sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:name', $clTRID, $trans); return; } if ($postalInfoIntOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:org', $clTRID, $trans); return; } } if ($postalInfoIntStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoIntStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoIntStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoIntStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoIntStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoIntCity)) { - sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:city', $clTRID, $trans); return; } if ($postalInfoIntSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoIntSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoIntSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:sp', $clTRID, $trans); return; } } if ($postalInfoIntPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoIntPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoIntPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:pc', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:cc', $clTRID, $trans); return; } } @@ -233,64 +233,64 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $postalInfoLocCc = (string) $postalInfoLoc->children('urn:ietf:params:xml:ns:contact-1.0')->addr->cc; if (!$postalInfoLocName) { - sendEppError($conn, 2003, 'Missing contact:name', $clTRID); + sendEppError($conn, $db, 2003, 'Missing contact:name', $clTRID, $trans); return; } if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocName) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocName)) { - sendEppError($conn, 2005, 'Invalid contact:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:name', $clTRID, $trans); return; } if ($postalInfoLocOrg) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocOrg) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocOrg)) { - sendEppError($conn, 2005, 'Invalid contact:org', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:org', $clTRID, $trans); return; } } if ($postalInfoLocStreet1) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet1) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet1)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoLocStreet2) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet2) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet2)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if ($postalInfoLocStreet3) { if (preg_match('/(^\-)|(^\,)|(^\.)|(\-\-)|(\,\,)|(\.\.)|(\-$)/', $postalInfoLocStreet3) || !preg_match('/^[a-zA-Z0-9\-\&\,\.\/\s]{5,}$/', $postalInfoLocStreet3)) { - sendEppError($conn, 2005, 'Invalid contact:street', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:street', $clTRID, $trans); return; } } if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocCity) || !preg_match('/^[a-z][a-z\-\.\s]{3,}$/i', $postalInfoLocCity)) { - sendEppError($conn, 2005, 'Invalid contact:city', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:city', $clTRID, $trans); return; } if ($postalInfoLocSp) { if (preg_match('/(^\-)|(^\.)|(\-\-)|(\.\.)|(\.\-)|(\-\.)|(\-$)|(\.$)/', $postalInfoLocSp) || !preg_match('/^[A-Z][a-zA-Z\-\.\s]{1,}$/', $postalInfoLocSp)) { - sendEppError($conn, 2005, 'Invalid contact:sp', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:sp', $clTRID, $trans); return; } } if ($postalInfoLocPc) { if (preg_match('/(^\-)|(\-\-)|(\-$)/', $postalInfoLocPc) || !preg_match('/^[A-Z0-9\-\s]{3,}$/', $postalInfoLocPc)) { - sendEppError($conn, 2005, 'Invalid contact:pc', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:pc', $clTRID, $trans); 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', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid contact:cc', $clTRID, $trans); return; } } @@ -300,7 +300,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $voice = (string) $contactUpdate->chg->voice; $voice_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})', $clTRID); + sendEppError($conn, $db, 2005, 'Voice must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID, $trans); return; } @@ -310,30 +310,30 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $fax_x = (string) $contactUpdate->chg->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})', $clTRID); + sendEppError($conn, $db, 2005, 'Fax must be (\+[0-9]{1,3}\.[0-9]{1,14})', $clTRID, $trans); return; } $email = (string) $contactUpdate->chg->email; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - sendEppError($conn, 2005, 'Email address failed check', $clTRID); + sendEppError($conn, $db, 2005, 'Email address failed check', $clTRID, $trans); return; } $authInfo_pw = (string) $contactUpdate->chg->authInfo->pw; if ($authInfo_pw) { 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', $clTRID); + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should have both upper and lower case characters', $clTRID); + sendEppError($conn, $db, 2005, 'Password should have both upper and lower case characters', $clTRID, $trans); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should contain one or more numbers', $clTRID); + sendEppError($conn, $db, 2005, 'Password should contain one or more numbers', $clTRID, $trans); return; } } @@ -396,12 +396,12 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $nin_type = (string)$identica_update->xpath('//identica:nin/@type[1]')[0]; if (!preg_match('/\d/', $nin)) { - sendEppError($conn, 2005, 'NIN should contain one or more numbers', $clTRID); + sendEppError($conn, $db, 2005, 'NIN should contain one or more numbers', $clTRID, $trans); return; } if (!in_array($nin_type, ['personal', 'business'])) { - sendEppError($conn, 2005, 'NIN Type should contain personal or business', $clTRID); + sendEppError($conn, $db, 2005, 'NIN Type should contain personal or business', $clTRID, $trans); return; } } @@ -588,7 +588,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt = $db->prepare($query); if (!$stmt) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } @@ -599,7 +599,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) { ]); if (!$result) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -631,12 +631,12 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $extension = 0; if ($hostRem === null && $hostAdd === null && $hostChg === null) { - sendEppError($conn, 2003, 'At least one host:rem || host:add || host:chg MUST be provided', $clTRID); + sendEppError($conn, $db, 2003, 'At least one host:rem || host:add || host:chg MUST be provided', $clTRID, $trans); return; } if (!$name) { - sendEppError($conn, 2003, 'The host being updated is not indicated', $clTRID); + sendEppError($conn, $db, 2003, 'The host being updated is not indicated', $clTRID, $trans); return; } @@ -650,7 +650,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $registrarIdHost = $row['clid'] ?? null; if (!$hostId) { - sendEppError($conn, 2303, 'Host does not exist in registry', $clTRID); + sendEppError($conn, $db, 2303, 'Host does not exist in registry', $clTRID, $trans); return; } @@ -661,7 +661,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid !== $registrarIdHost) { - sendEppError($conn, 2201, 'Not registrar for host', $clTRID); + sendEppError($conn, $db, 2201, 'Not registrar for host', $clTRID, $trans); return; } @@ -671,7 +671,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { while ($rowStatus = $stmtStatus->fetch(PDO::FETCH_ASSOC)) { $status = $rowStatus['status']; if (preg_match('/(serverUpdateProhibited)$/', $status) || preg_match('/^pending/', $status)) { - sendEppError($conn, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification', $clTRID); + sendEppError($conn, $db, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification', $clTRID, $trans); return; } } @@ -687,7 +687,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $statusList = $xml->xpath('//host:rem/host:status/@s'); if (count($addrList) == 0 && count($statusList) == 0) { - sendEppError($conn, 2005, 'At least one element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one element MUST be present', $clTRID, $trans); return; } @@ -697,14 +697,14 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clientUpdateProhibited = 0; } if (!in_array($status, ['clientDeleteProhibited', 'clientUpdateProhibited'])) { - sendEppError($conn, 2005, 'Only these statuses clientDeleteProhibited|clientUpdateProhibited are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these statuses clientDeleteProhibited|clientUpdateProhibited are accepted', $clTRID, $trans); return; } } } if ($clientUpdateProhibited) { - sendEppError($conn, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID); + sendEppError($conn, $db, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID, $trans); return; } @@ -713,14 +713,14 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $status_list = $xml->xpath('//host:add/host:status/@s'); if (count($addr_list) == 0 && count($status_list) == 0) { - sendEppError($conn, 2005, 'At least one element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one element MUST be present', $clTRID, $trans); return; } foreach ($status_list as $node) { $status = (string) $node; if (!preg_match('/^(clientDeleteProhibited|clientUpdateProhibited)$/', $status)) { - sendEppError($conn, 2005, 'Only these statuses clientDeleteProhibited|clientUpdateProhibited are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these statuses clientDeleteProhibited|clientUpdateProhibited are accepted', $clTRID, $trans); return; } @@ -729,7 +729,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$hostId, $status]); $contact_status_id = $stmt->fetchColumn(); if ($contact_status_id) { - sendEppError($conn, 2306, 'This status '.$status.' already exists for this host', $clTRID); + sendEppError($conn, $db, 2306, 'This status '.$status.' already exists for this host', $clTRID, $trans); return; } } @@ -747,12 +747,12 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$hostId, $addr]); $ipv6_addr_already_exists = $stmt->fetchColumn(); if ($ipv6_addr_already_exists) { - sendEppError($conn, 2306, 'This addr '.$addr.' already exists for this host', $clTRID); + sendEppError($conn, $db, 2306, 'This addr '.$addr.' already exists for this host', $clTRID, $trans); return; } } else { // Invalid IPv6 - sendEppError($conn, 2005, 'Invalid host:addr v6', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:addr v6', $clTRID, $trans); return; } } else { @@ -763,16 +763,16 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$hostId, $addr]); $ipv4_addr_already_exists = $stmt->fetchColumn(); if ($ipv4_addr_already_exists) { - sendEppError($conn, 2306, 'This addr '.$addr.' already exists for this host', $clTRID); + sendEppError($conn, $db, 2306, 'This addr '.$addr.' already exists for this host', $clTRID, $trans); return; } if ($addr == '127.0.0.1') { - sendEppError($conn, 2005, 'Invalid host:addr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:addr v4', $clTRID, $trans); return; } } else { // Invalid IPv4 - sendEppError($conn, 2005, 'Invalid host:addr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:addr v4', $clTRID, $trans); return; } } @@ -790,11 +790,11 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $chg_name_id = $stmt->fetchColumn(); if ($chg_name_id) { - sendEppError($conn, 2306, 'If it already exists, then we can\'t change it', $clTRID); + sendEppError($conn, $db, 2306, 'If it already exists, then we can\'t change it', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid host:name', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid host:name', $clTRID, $trans); return; } @@ -808,7 +808,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $domain_name = $stmt->fetchColumn(); if (!stripos($chg_name, ".$domain_name")) { - sendEppError($conn, 2005, 'It must be a subdomain of '.$domain_name, $clTRID); + sendEppError($conn, $db, 2005, 'It must be a subdomain of '.$domain_name, $clTRID, $trans); return; } } else { @@ -826,7 +826,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { } if ($internal_host) { - sendEppError($conn, 2005, 'Must be external host', $clTRID); + sendEppError($conn, $db, 2005, 'Must be external host', $clTRID, $trans); return; } } @@ -840,7 +840,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $domain_host_map_id = $stmt->fetchColumn(); if ($domain_host_map_id) { - sendEppError($conn, 2305, 'It is not possible to modify because it is a dependency, it is used by some domain as NS', $clTRID); + sendEppError($conn, $db, 2305, 'It is not possible to modify because it is a dependency, it is used by some domain as NS', $clTRID, $trans); return; } } @@ -889,7 +889,7 @@ function processHostUpdate($conn, $db, $xml, $clid, $database_type, $trans) { } elseif ($database_type === 'pgsql' && $e->errorInfo[1] == 23505) { // Duplicate entry error for PostgreSQL. Silently ignore. } else { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -947,12 +947,12 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { } if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) { - sendEppError($conn, 2003, 'At least one domain:rem || domain:add || domain:chg', $clTRID); + sendEppError($conn, $db, 2003, 'At least one domain:rem || domain:add || domain:chg', $clTRID, $trans); return; } if (!$domainName) { - sendEppError($conn, 2003, 'Domain name is not provided', $clTRID); + sendEppError($conn, $db, 2003, 'Domain name is not provided', $clTRID, $trans); return; } @@ -961,7 +961,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { - sendEppError($conn, 2303, 'Domain name does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Domain name does not exist', $clTRID, $trans); return; } @@ -972,7 +972,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clid = $clid['id']; if ($clid != $row['clid']) { - sendEppError($conn, 2201, 'You do not have privileges to modify a domain name that belongs to another registrar', $clTRID); + sendEppError($conn, $db, 2201, 'You do not have privileges to modify a domain name that belongs to another registrar', $clTRID, $trans); return; } @@ -982,7 +982,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute([$row['id']]); while ($status = $stmt->fetchColumn()) { if (strpos($status, 'serverUpdateProhibited') !== false || strpos($status, 'pendingTransfer') !== false) { - sendEppError($conn, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification, first change the status and then update', $clTRID); + sendEppError($conn, $db, 2304, 'It has a serverUpdateProhibited or pendingUpdate status that does not allow modification, first change the status and then update', $clTRID, $trans); return; } } @@ -998,7 +998,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $statusList = $xml->xpath('//domain:rem/domain:status/@s') ?? []; if (!$ns && count($contact_list) == 0 && count($statusList) == 0) { - sendEppError($conn, 2005, 'At least one element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one element MUST be present', $clTRID, $trans); return; } @@ -1008,14 +1008,14 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $clientUpdateProhibited = 0; } if (!in_array($status, ['clientDeleteProhibited', 'clientTransferProhibited', 'clientUpdateProhibited', 'clientRenewProhibited'])) { - sendEppError($conn, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited|clientRenewProhibited statuses are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited|clientRenewProhibited statuses are accepted', $clTRID, $trans); return; } } } if ($clientUpdateProhibited) { - sendEppError($conn, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID); + sendEppError($conn, $db, 2304, 'It has clientUpdateProhibited status, but you did not indicate this status when deleting', $clTRID, $trans); return; } @@ -1035,7 +1035,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $statusList = $xml->xpath('//domain:add/domain:status/@s'); if (!$ns && !count($contact_list) && !count($statusList) && !count($hostObjList) && !count($hostAttrList)) { - sendEppError($conn, 2005, 'At least one element MUST be present', $clTRID); + sendEppError($conn, $db, 2005, 'At least one element MUST be present', $clTRID, $trans); return; } @@ -1043,7 +1043,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $status = (string) $node; if (!preg_match('/^(clientDeleteProhibited|clientHold|clientRenewProhibited|clientTransferProhibited|clientUpdateProhibited)$/', $status)) { - sendEppError($conn, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID); + sendEppError($conn, $db, 2005, 'Only these clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited statuses are accepted', $clTRID, $trans); return; } @@ -1055,24 +1055,24 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $domainStatusId = $stmt->fetchColumn(); if ($domainStatusId) { - sendEppError($conn, 2306, 'This status '.$status.' already exists for this domain', $clTRID); + sendEppError($conn, $db, 2306, 'This status '.$status.' already exists for this domain', $clTRID, $trans); return; } } } if (count($hostObjList) > 0 && count($hostAttrList) > 0) { - sendEppError($conn, 2001, 'It cannot be hostObj and hostAttr at the same time, either one or the other', $clTRID); + sendEppError($conn, $db, 2001, 'It cannot be hostObj and hostAttr at the same time, either one or the other', $clTRID, $trans); return; } if (count($hostObjList) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID, $trans); return; } if (count($hostAttrList) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID, $trans); return; } } @@ -1086,7 +1086,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostObjList as $node) { $hostObj = (string)$node; if (isset($nsArr[$hostObj])) { - sendEppError($conn, 2306, "Duplicate NAMESERVER ($hostObj)", $clTRID); + sendEppError($conn, $db, 2306, "Duplicate NAMESERVER ($hostObj)", $clTRID, $trans); return; } $nsArr[$hostObj] = 1; @@ -1099,7 +1099,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostAttrList as $node) { $hostName = (string)$node; if (isset($nsArr[$hostName])) { - sendEppError($conn, 2306, "Duplicate NAMESERVER ($hostName)", $clTRID); + sendEppError($conn, $db, 2306, "Duplicate NAMESERVER ($hostName)", $clTRID, $trans); return; } $nsArr[$hostName] = 1; @@ -1111,7 +1111,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostObjList as $node) { $hostObj = strtoupper((string)$node); if (preg_match('/[^A-Z0-9\.\-]/', $hostObj) || preg_match('/^-|^\.-|-\.-|^-|-$/', $hostObj)) { - sendEppError($conn, 2005, 'Invalid domain:hostObj', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostObj', $clTRID, $trans); return; } @@ -1138,13 +1138,13 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt->execute(); $host_id_already_exist = $stmt->fetchColumn(); if (!$host_id_already_exist) { - sendEppError($conn, 2303, 'Invalid domain:hostObj '.$hostObj, $clTRID); + sendEppError($conn, $db, 2303, 'Invalid domain:hostObj '.$hostObj, $clTRID, $trans); return; } } } } else { - sendEppError($conn, 2005, 'Invalid domain:hostObj', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostObj', $clTRID, $trans); return; } } @@ -1155,14 +1155,14 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $hostName = (string)$node->xpath('domain:hostName[1]')[0]; $hostName = strtoupper($hostName); if (preg_match('/[^A-Z0-9\.\-]/', $hostName) || preg_match('/^-|^\.-|-\.-|\.\.-|$-|\.$/', $hostName)) { - sendEppError($conn, 2005, 'Invalid domain:hostName', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostName', $clTRID, $trans); return; } if (strpos($hostName, $domainName) !== false) { $hostAddrList = $node->xpath('domain:hostAddr'); if (count($hostAddrList) > 13) { - sendEppError($conn, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID); + sendEppError($conn, $db, 2306, 'No more than 13 domain:hostObj are allowed', $clTRID, $trans); return; } @@ -1170,7 +1170,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { foreach ($hostAddrList as $addrNode) { $hostAddr = (string)$addrNode; if (isset($nsArr[$hostAddr])) { - sendEppError($conn, 2306, "Duplicate IP ($hostAddr)", $clTRID); + sendEppError($conn, $db, 2306, "Duplicate IP ($hostAddr)", $clTRID, $trans); return; } $nsArr[$hostAddr] = 1; @@ -1183,18 +1183,18 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if ($addrType === 'v6') { if (!filter_var($hostAddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v6', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v6', $clTRID, $trans); return; } } else { if (!filter_var($hostAddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) || $hostAddr == '127.0.0.1') { - sendEppError($conn, 2005, 'Invalid domain:hostAddr v4', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid domain:hostAddr v4', $clTRID, $trans); return; } } } } else { - sendEppError($conn, 2005, "Invalid domain:hostName $hostName", $clTRID); + sendEppError($conn, $db, 2005, "Invalid domain:hostName $hostName", $clTRID, $trans); return; } } @@ -1212,7 +1212,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $contact_id = $stmt->fetchColumn(); if (!$contact_id) { - sendEppError($conn, 2303, 'This contact '.$contact.' does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'This contact '.$contact.' does not exist', $clTRID, $trans); return; } @@ -1221,7 +1221,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $domain_contact_map_id = $stmt2->fetchColumn(); if ($domain_contact_map_id) { - sendEppError($conn, 2306, 'This contact '.$contact.' already exists for type '.$contact_type, $clTRID); + sendEppError($conn, $db, 2306, 'This contact '.$contact.' already exists for type '.$contact_type, $clTRID, $trans); return; } } @@ -1239,7 +1239,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $registrant_id = $stmt3->fetchColumn(); if (!$registrant_id) { - sendEppError($conn, 2303, 'Registrant does not exist', $clTRID); + sendEppError($conn, $db, 2303, 'Registrant does not exist', $clTRID, $trans); return; } } @@ -1248,7 +1248,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $stmt4->execute([$row['id']]); while ($status = $stmt4->fetchColumn()) { if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pendingTransfer/', $status)) { - sendEppError($conn, 2304, 'It has a status that does not allow modification, first change the status then update', $clTRID); + sendEppError($conn, $db, 2304, 'It has a status that does not allow modification, first change the status then update', $clTRID, $trans); return; } } @@ -1256,17 +1256,17 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $authInfo_pw = (string)$domainChg->xpath('//domain:authInfo/domain:pw[1]')[0]; if ($authInfo_pw) { 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', $clTRID); + sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); return; } if (!preg_match('/[A-Z]/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should have both upper and lower case characters', $clTRID); + sendEppError($conn, $db, 2005, 'Password should have both upper and lower case characters', $clTRID, $trans); return; } if (!preg_match('/\d/', $authInfo_pw)) { - sendEppError($conn, 2005, 'Password should contain one or more numbers', $clTRID); + sendEppError($conn, $db, 2005, 'Password should contain one or more numbers', $clTRID, $trans); return; } } @@ -1282,7 +1282,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $temp_id_rgpstatus = $stmt->fetchColumn(); if ($temp_id_rgpstatus == 0) { - sendEppError($conn, 2304, 'pendingRestore can only be done if the domain is now in redemptionPeriod rgpStatus', $clTRID); + sendEppError($conn, $db, 2304, 'pendingRestore can only be done if the domain is now in redemptionPeriod rgpStatus', $clTRID, $trans); return; } @@ -1292,7 +1292,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $temp_id_status = $stmt->fetchColumn(); if ($temp_id_status == 0) { - sendEppError($conn, 2304, 'pendingRestore can only be done if the domain is now in pendingDelete status', $clTRID); + sendEppError($conn, $db, 2304, 'pendingRestore can only be done if the domain is now in pendingDelete status', $clTRID, $trans); return; } } elseif ($op_attribute === 'report') { @@ -1302,7 +1302,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $temp_id = $stmt->fetchColumn(); if ($temp_id == 0) { - sendEppError($conn, 2304, 'report can only be sent if the domain is in pendingRestore status', $clTRID); + sendEppError($conn, $db, 2304, 'report can only be sent if the domain is in pendingRestore status', $clTRID, $trans); return; } } @@ -1429,7 +1429,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $sth = $db->prepare("SELECT `tld` FROM `domain_tld`"); if (!$sth->execute()) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } @@ -1446,28 +1446,28 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if (preg_match("/\.$domainName$/i", $hostObj)) { $sth = $db->prepare("INSERT INTO `host` (`name`,`domain_id`,`clid`,`crid`,`crdate`) VALUES(?, ?, ?, ?, CURRENT_TIMESTAMP)"); if (!$sth->execute([$hostObj, $domain_id, $clid, $clid])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } $host_id = $db->lastInsertId(); $sth = $db->prepare("INSERT INTO `domain_host_map` (`domain_id`,`host_id`) VALUES(?, ?)"); if (!$sth->execute([$domain_id, $host_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } } else { $sth = $db->prepare("INSERT INTO `host` (`name`,`clid`,`crid`,`crdate`) VALUES(?, ?, ?, CURRENT_TIMESTAMP)"); if (!$sth->execute([$hostObj, $clid, $clid])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } $host_id = $db->lastInsertId(); $sth = $db->prepare("INSERT INTO `domain_host_map` (`domain_id`,`host_id`) VALUES(?, ?)"); if (!$sth->execute([$domain_id, $host_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1492,14 +1492,14 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if (!$domain_host_map_id) { $sth = $db->prepare("INSERT INTO `domain_host_map` (`domain_id`,`host_id`) VALUES(?, ?)"); if (!$sth->execute([$domain_id, $hostName_already_exist])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } else { $logMessage = "Domain : $domainName ; hostName : $hostName - se dubleaza"; $sth = $db->prepare("INSERT INTO `error_log` (`registrar_id`,`log`,`date`) VALUES(?, ?, CURRENT_TIMESTAMP)"); if (!$sth->execute([$clid, $logMessage])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1553,7 +1553,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { } catch (PDOException $e) { $codesToIgnore = ['23000', '23505']; if (!in_array($e->getCode(), $codesToIgnore)) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1570,7 +1570,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { } catch (PDOException $e) { $codesToIgnore = ['23000', '23505']; if (!in_array($e->getCode(), $codesToIgnore)) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1590,13 +1590,13 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $sth = $db->prepare("UPDATE `domain` SET `registrant` = ?, `update` = CURRENT_TIMESTAMP WHERE `id` = ?"); if (!$sth->execute([$registrant_id, $domain_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } else { $sth = $db->prepare("UPDATE `domain` SET `registrant` = NULL, `update` = CURRENT_TIMESTAMP WHERE `id` = ?"); if (!$sth->execute([$domain_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1608,7 +1608,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if ($authInfo_pw) { $sth = $db->prepare("UPDATE `domain_authInfo` SET `authinfo` = ? WHERE `domain_id` = ? AND `authtype` = ?"); if (!$sth->execute([$authInfo_pw, $domain_id, 'pw'])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1621,7 +1621,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if (isset($authInfo_ext)) { $sth = $db->prepare("UPDATE `domain_authInfo` SET `authinfo` = ? WHERE `domain_id` = ? AND `authtype` = ?"); if (!$sth->execute([$authInfo_ext, $domain_id, 'ext'])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1634,7 +1634,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if (isset($authInfo_null)) { $sth = $db->prepare("DELETE FROM `domain_authInfo` WHERE `domain_id` = ?"); if (!$sth->execute([$domain_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1651,11 +1651,11 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if ($temp_id == 1) { $sth = $db->prepare("UPDATE `domain` SET `rgpstatus` = 'pendingRestore', `resTime` = CURRENT_TIMESTAMP, `update` = CURRENT_TIMESTAMP WHERE `id` = ?"); if (!$sth->execute([$domain_id])) { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } else { - sendEppError($conn, 2304, 'pendingRestore can only be done if the domain is now in redemptionPeriod', $clTRID); + sendEppError($conn, $db, 2304, 'pendingRestore can only be done if the domain is now in redemptionPeriod', $clTRID, $trans); return; } } elseif ($op_attribute == 'report') { @@ -1677,7 +1677,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $restore_price = $sth->fetchColumn(); if (($registrar_balance + $creditLimit) < ($renew_price + $restore_price)) { - sendEppError($conn, 2104, 'There is no money on the account for restore and renew', $clTRID); + sendEppError($conn, $db, 2104, 'There is no money on the account for restore and renew', $clTRID, $trans); return; } @@ -1688,7 +1688,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { $sth = $db->prepare("UPDATE `domain` SET `exdate` = DATE_ADD(`exdate`, INTERVAL 12 MONTH), `rgpstatus` = NULL, `rgpresTime` = CURRENT_TIMESTAMP, `update` = CURRENT_TIMESTAMP WHERE `id` = ?"); if (!$sth->execute([$domain_id])) { - sendEppError($conn, 2400, 'It was not renewed successfully, something is wrong', $clTRID); + sendEppError($conn, $db, 2400, 'It was not renewed successfully, something is wrong', $clTRID, $trans); return; } else { $sth = $db->prepare("DELETE FROM `domain_status` WHERE `domain_id` = ? AND `status` = ?"); @@ -1728,7 +1728,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { ->execute(); } } else { - sendEppError($conn, 2304, 'report can only be sent if the domain is in pendingRestore status', $clTRID); + sendEppError($conn, $db, 2304, 'report can only be sent if the domain is in pendingRestore status', $clTRID, $trans); return; } } @@ -1751,24 +1751,24 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { // Data sanity checks // Validate keyTag if (!isset($keyTag) || !is_int($keyTag)) { - sendEppError($conn, 2005, 'Incomplete keyTag provided', $clTRID); + sendEppError($conn, $db, 2005, 'Incomplete keyTag provided', $clTRID, $trans); return; } if ($keyTag < 0 || $keyTag > 65535) { - sendEppError($conn, 2006, 'Invalid keyTag provided', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid keyTag provided', $clTRID, $trans); return; } // Validate alg $validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16]; if (!isset($alg) || !in_array($alg, $validAlgorithms)) { - sendEppError($conn, 2006, 'Invalid algorithm', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid algorithm', $clTRID, $trans); return; } // Validate digestType and digest if (!isset($digestType) || !is_int($digestType)) { - sendEppError($conn, 2005, 'Invalid digestType', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid digestType', $clTRID, $trans); return; } $validDigests = [ @@ -1777,11 +1777,11 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { 4 => 96 // SHA-384 ]; if (!isset($validDigests[$digestType])) { - sendEppError($conn, 2006, 'Unsupported digestType', $clTRID); + sendEppError($conn, $db, 2006, 'Unsupported digestType', $clTRID, $trans); return; } if (!isset($digest) || strlen($digest) != $validDigests[$digestType] || !ctype_xdigit($digest)) { - sendEppError($conn, 2006, 'Invalid digest length or format', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid digest length or format', $clTRID, $trans); return; } @@ -1795,7 +1795,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { ':digest' => $digest ]); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error during dsData removal', $clTRID); + sendEppError($conn, $db, 2400, 'Database error during dsData removal', $clTRID, $trans); return; } } @@ -1817,24 +1817,24 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { // Data sanity checks // Validate keyTag if (!isset($keyTag) || !is_int($keyTag)) { - sendEppError($conn, 2005, 'Incomplete keyTag provided', $clTRID); + sendEppError($conn, $db, 2005, 'Incomplete keyTag provided', $clTRID, $trans); return; } if ($keyTag < 0 || $keyTag > 65535) { - sendEppError($conn, 2006, 'Invalid keyTag provided', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid keyTag provided', $clTRID, $trans); return; } // Validate alg $validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16]; if (!isset($alg) || !in_array($alg, $validAlgorithms)) { - sendEppError($conn, 2006, 'Invalid algorithm', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid algorithm', $clTRID, $trans); return; } // Validate digestType and digest if (!isset($digestType) || !is_int($digestType)) { - sendEppError($conn, 2005, 'Invalid digestType', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid digestType', $clTRID, $trans); return; } $validDigests = [ @@ -1843,11 +1843,11 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { 4 => 96 // SHA-384 ]; if (!isset($validDigests[$digestType])) { - sendEppError($conn, 2006, 'Unsupported digestType', $clTRID); + sendEppError($conn, $db, 2006, 'Unsupported digestType', $clTRID, $trans); return; } if (!isset($digest) || strlen($digest) != $validDigests[$digestType] || !ctype_xdigit($digest)) { - sendEppError($conn, 2006, 'Invalid digest length or format', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid digest length or format', $clTRID, $trans); return; } @@ -1867,25 +1867,25 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { // Validate flags $validFlags = [256, 257]; if (isset($flags) && !in_array($flags, $validFlags)) { - sendEppError($conn, 2005, 'Invalid flags', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid flags', $clTRID, $trans); return; } // Validate protocol if (isset($protocol) && $protocol != 3) { - sendEppError($conn, 2006, 'Invalid protocol', $clTRID); + sendEppError($conn, $db, 2006, 'Invalid protocol', $clTRID, $trans); return; } // Validate algKeyData if (isset($algKeyData)) { - sendEppError($conn, 2005, 'Invalid algKeyData encoding', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid algKeyData encoding', $clTRID, $trans); return; } // Validate pubKey if (isset($pubKey) && base64_encode(base64_decode($pubKey, true)) !== $pubKey) { - sendEppError($conn, 2005, 'Invalid pubKey encoding', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid pubKey encoding', $clTRID, $trans); return; } } @@ -1912,7 +1912,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { if ($isMySQLUniqueViolation || $isPostgreSQLUniqueViolation) { // Do nothing } else { - sendEppError($conn, 2400, 'Database error', $clTRID); + sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans); return; } } @@ -1934,11 +1934,11 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) { ':domain_id' => $domain_id ]); } catch (PDOException $e) { - sendEppError($conn, 2400, 'Database error during maxSigLife update', $clTRID); + sendEppError($conn, $db, 2400, 'Database error during maxSigLife update', $clTRID, $trans); return; } } else { - sendEppError($conn, 2005, 'Invalid or missing maxSigLife', $clTRID); + sendEppError($conn, $db, 2005, 'Invalid or missing maxSigLife', $clTRID, $trans); return; } } diff --git a/epp/src/helpers.php b/epp/src/helpers.php index 44c2636..ba00aac 100644 --- a/epp/src/helpers.php +++ b/epp/src/helpers.php @@ -48,21 +48,25 @@ function sendGreeting($conn) { sendEppResponse($conn, $xml); } -function sendEppError($conn, $code, $msg, $clTRID = "000") { +function sendEppError($conn, $db, $code, $msg, $clTRID = "000", $trans = "0") { if (!isset($clTRID)) { $clTRID = "000"; } - + if (!isset($trans)) { + $trans = "0"; + } + $svTRID = generateSvTRID(); $response = [ 'command' => 'error', 'resultCode' => $code, 'human_readable_message' => $msg, 'clTRID' => $clTRID, - 'svTRID' => generateSvTRID(), + 'svTRID' => $svTRID, ]; $epp = new EPP\EppWriter(); $xml = $epp->epp_writer($response); + updateTransaction($db, null, null, 'error', $code, $msg, $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } diff --git a/epp/start.php b/epp/start.php index 7c51d4a..e861c49 100644 --- a/epp/start.php +++ b/epp/start.php @@ -58,7 +58,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $connId = spl_object_id($conn); if ($data === false || strlen($data) < 4) { - sendEppError($conn, 2100, 'Data reception error'); + sendEppError($conn, $db, 2100, 'Data reception error'); break; } @@ -79,7 +79,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xml->registerXPathNamespace('secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1'); if ($xml === false) { - sendEppError($conn, 2001, 'Invalid XML'); + sendEppError($conn, $db, 2001, 'Invalid XML'); break; } @@ -113,7 +113,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { updateTransaction($db, 'login', null, null, 1000, 'Command completed successfully', $svTRID, $xml, $trans); sendEppResponse($conn, $xml); } else { - sendEppError($conn, 2200, 'Authentication error', $clTRID); + sendEppError($conn, $db, 2200, 'Authentication error', $clTRID); } break; } @@ -157,7 +157,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processPoll($conn, $db, $xml, $data['clid'], $trans); @@ -172,7 +172,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactCheck($conn, $db, $xml, $trans); @@ -187,7 +187,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactCreate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -202,7 +202,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactInfo($conn, $db, $xml, $trans); @@ -217,7 +217,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactUpdate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -232,7 +232,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactDelete($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -247,7 +247,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processContactTransfer($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -262,7 +262,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainCheck($conn, $db, $xml, $trans); @@ -277,7 +277,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainInfo($conn, $db, $xml, $trans); @@ -292,7 +292,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainUpdate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -307,7 +307,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainCreate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -322,7 +322,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainDelete($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -337,7 +337,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainTransfer($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -352,7 +352,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processHostCheck($conn, $db, $xml, $trans); @@ -367,7 +367,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processHostCreate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -382,7 +382,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processHostInfo($conn, $db, $xml, $trans); @@ -397,7 +397,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processHostUpdate($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -412,7 +412,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processHostDelete($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -427,7 +427,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processFundsInfo($conn, $db, $xml, $data['clid'], $trans); @@ -442,7 +442,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { $xmlString = $xml->asXML(); $trans = createTransaction($db, $clid, $clTRID, $xmlString); if (!$data || $data['logged_in'] !== 1) { - sendEppError($conn, 2202, 'Authorization error', $clTRID); + sendEppError($conn, $db, 2202, 'Authorization error', $clTRID); $conn->close(); } processDomainRenew($conn, $db, $xml, $data['clid'], $c['db_type'], $trans); @@ -451,13 +451,13 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) { default: { - sendEppError($conn, 2102, 'Unrecognized command'); + sendEppError($conn, $db, 2102, 'Unrecognized command'); break; } } } - sendEppError($conn, 2100, 'Unknown command'); + sendEppError($conn, $db, 2100, 'Unknown command'); echo "Client disconnected.\n"; });