More RST fixes

This commit is contained in:
Pinga 2025-04-30 12:39:10 +03:00
parent b150d95b36
commit b11a80e0fb
7 changed files with 94 additions and 41 deletions

View file

@ -414,20 +414,33 @@ try {
// Start of svcExtension // Start of svcExtension
$xml->startElementNS('rdeEppParams', 'svcExtension', null); $xml->startElementNS('rdeEppParams', 'svcExtension', null);
$extUriArray = [];
if (file_exists('/opt/registry/epp/extensions.json')) {
$json = file_get_contents('/opt/registry/epp/extensions.json');
$data = json_decode($json, true);
// Add extURI elements if (is_array($data)) {
$extUriArray = [ foreach ($data as $urn => $ext) {
'https://namingo.org/epp/funds-1.0', if (!empty($ext['enabled'])) {
'https://namingo.org/epp/identica-1.0', $extUriArray[] = $urn;
'urn:ietf:params:xml:ns:secDNS-1.1', }
'urn:ietf:params:xml:ns:rgp-1.0', }
'urn:ietf:params:xml:ns:launch-1.0', }
'urn:ietf:params:xml:ns:idn-1.0', }
'urn:ietf:params:xml:ns:epp:fee-1.0', // Fallback to hardcoded list if needed
'urn:ietf:params:xml:ns:mark-1.0', if (empty($extUriArray)) {
'urn:ietf:params:xml:ns:allocationToken-1.0' $extUriArray = [
]; 'https://namingo.org/epp/funds-1.0',
'https://namingo.org/epp/identica-1.0',
'urn:ietf:params:xml:ns:secDNS-1.1',
'urn:ietf:params:xml:ns:rgp-1.0',
'urn:ietf:params:xml:ns:launch-1.0',
'urn:ietf:params:xml:ns:idn-1.0',
'urn:ietf:params:xml:ns:epp:fee-1.0',
'urn:ietf:params:xml:ns:mark-1.0',
'urn:ietf:params:xml:ns:allocationToken-1.0'
];
}
foreach ($extUriArray as $extUri) { foreach ($extUriArray as $extUri) {
$xml->writeElementNS('epp', 'extURI', null, $extUri); $xml->writeElementNS('epp', 'extURI', null, $extUri);
} }

View file

@ -244,8 +244,8 @@ class ContactsController extends Controller
return $response->withHeader('Location', '/contact/create')->withStatus(302); return $response->withHeader('Location', '/contact/create')->withStatus(302);
} }
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) {
$this->container->get('flash')->addMessage('error', 'Unable to create contact: Password needs to be at least 6 and up to 16 characters long'); $this->container->get('flash')->addMessage('error', 'Unable to create contact: Password needs to be at least 6 and up to 64 characters long');
return $response->withHeader('Location', '/contact/create')->withStatus(302); return $response->withHeader('Location', '/contact/create')->withStatus(302);
} }
@ -644,8 +644,8 @@ class ContactsController extends Controller
return $response->withHeader('Content-Type', 'application/json')->withStatus(400); return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
} }
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) {
$error = ["error" => "Unable to create contact: Password needs to be at least 6 and up to 16 characters long"]; $error = ["error" => "Unable to create contact: Password needs to be at least 6 and up to 64 characters long"];
$response->getBody()->write(json_encode($error)); $response->getBody()->write(json_encode($error));
return $response->withHeader('Content-Type', 'application/json')->withStatus(400); return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
} }
@ -1498,8 +1498,8 @@ class ContactsController extends Controller
return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302); return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302);
} }
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) {
$this->container->get('flash')->addMessage('error', 'Unable to update contact: Password needs to be at least 6 and up to 16 characters long'); $this->container->get('flash')->addMessage('error', 'Unable to update contact: Password needs to be at least 6 and up to 64 characters long');
return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302); return $response->withHeader('Location', '/contact/update/'.$identifier)->withStatus(302);
} }

41
epp/extensions.json Normal file
View file

@ -0,0 +1,41 @@
{
"urn:ietf:params:xml:ns:secDNS-1.1": {
"enabled": true
},
"urn:ietf:params:xml:ns:rgp-1.0": {
"enabled": true
},
"urn:ietf:params:xml:ns:launch-1.0": {
"enabled": true
},
"urn:ietf:params:xml:ns:epp:fee-1.0": {
"enabled": true
},
"urn:ietf:params:xml:ns:secDNS-1.1": {
"enabled": true
},
"urn:ietf:params:xml:ns:allocationToken-1.0": {
"enabled": true
},
"urn:ietf:params:xml:ns:epp:loginSec-1.0": {
"enabled": false
},
"urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0": {
"enabled": false
},
"urn:ietf:params:xml:ns:epp:secure-authinfo-transfer-1.0": {
"enabled": false
},
"urn:ietf:params:xml:ns:idn-1.0": {
"enabled": true
},
"urn:ietf:params:xml:ns:mark-1.0": {
"enabled": true
},
"https://namingo.org/epp/funds-1.0": {
"enabled": true
},
"https://namingo.org/epp/identica-1.0": {
"enabled": true
}
}

View file

@ -377,8 +377,12 @@ class EppWriter {
private function _postamble($writer, $resp) { private function _postamble($writer, $resp) {
if (isset($resp['clTRID']) || isset($resp['svTRID'])) { if (isset($resp['clTRID']) || isset($resp['svTRID'])) {
$writer->startElement('trID'); $writer->startElement('trID');
$writer->writeElement('clTRID', $resp['clTRID']); if (isset($resp['clTRID']) && $resp['clTRID'] !== '') {
$writer->writeElement('svTRID', $resp['svTRID']); $writer->writeElement('clTRID', $resp['clTRID']);
}
if (isset($resp['svTRID']) && $resp['svTRID'] !== '') {
$writer->writeElement('svTRID', $resp['svTRID']);
}
$writer->endElement(); // End of 'trID' $writer->endElement(); // End of 'trID'
} }
$writer->endElement(); // End of 'response' $writer->endElement(); // End of 'response'

View file

@ -242,8 +242,8 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) {
return; return;
} }
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) {
sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans);
return; return;
} }
@ -1228,8 +1228,8 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
return; return;
} }
if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 16) { if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 64) {
sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans);
return; return;
} }

View file

@ -318,8 +318,8 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$authInfo_pw = (string) $contactUpdate->chg->authInfo->pw; $authInfo_pw = (string) $contactUpdate->chg->authInfo->pw;
if ($authInfo_pw) { if ($authInfo_pw) {
if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 16)) { if ((strlen($authInfo_pw) < 6) || (strlen($authInfo_pw) > 64)) {
sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans);
return; return;
} }
@ -1349,8 +1349,8 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$authInfo_pw = (string)$authInfo_pw_elements[0]; $authInfo_pw = (string)$authInfo_pw_elements[0];
if ($authInfo_pw) { if ($authInfo_pw) {
if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 16) { if (strlen($authInfo_pw) < 6 || strlen($authInfo_pw) > 64) {
sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 16 characters long', $clTRID, $trans); sendEppError($conn, $db, 2005, 'Password needs to be at least 6 and up to 64 characters long', $clTRID, $trans);
return; return;
} }

View file

@ -99,10 +99,15 @@ function checkLogin($db, $clID, $pw) {
return password_verify($pw, $hashedPassword); return password_verify($pw, $hashedPassword);
} }
function sendGreeting($conn) { function sendGreeting($conn, Swoole\Table $eppExtensionsTable) {
global $c; global $c;
$currentDateTime = new DateTime("now", new DateTimeZone("UTC")); $currentDateTime = new DateTime("now", new DateTimeZone("UTC"));
$currentDate = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); $currentDate = $currentDateTime->format("Y-m-d\TH:i:s.v\Z");
$extensions = [];
foreach ($eppExtensionsTable as $urn => $row) {
$extensions[] = $urn;
}
$response = [ $response = [
'command' => 'greeting', 'command' => 'greeting',
@ -115,17 +120,7 @@ function sendGreeting($conn) {
'urn:ietf:params:xml:ns:contact-1.0', 'urn:ietf:params:xml:ns:contact-1.0',
'urn:ietf:params:xml:ns:host-1.0' 'urn:ietf:params:xml:ns:host-1.0'
], ],
'extensions' => [ 'extensions' => $extensions,
'https://namingo.org/epp/funds-1.0',
'https://namingo.org/epp/identica-1.0',
'urn:ietf:params:xml:ns:secDNS-1.1',
'urn:ietf:params:xml:ns:rgp-1.0',
'urn:ietf:params:xml:ns:launch-1.0',
'urn:ietf:params:xml:ns:idn-1.0',
'urn:ietf:params:xml:ns:epp:fee-1.0',
'urn:ietf:params:xml:ns:mark-1.0',
'urn:ietf:params:xml:ns:allocationToken-1.0'
],
'dcp' => [ // Data Collection Policy (optional) 'dcp' => [ // Data Collection Policy (optional)
'access' => ['all'], 'access' => ['all'],
'statement' => [ 'statement' => [