mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-26 14:14:41 +02:00
Updated epp domain info; added rgp and secdns extensions
This commit is contained in:
parent
4ec93e053e
commit
1c2c147601
2 changed files with 128 additions and 13 deletions
|
@ -708,13 +708,13 @@ class EppWriter {
|
||||||
}
|
}
|
||||||
$writer->endElement(); // End of 'domain:ns'
|
$writer->endElement(); // End of 'domain:ns'
|
||||||
}
|
}
|
||||||
if (isset($resp['return_host'])) {
|
if (isset($resp['return_host'])) {
|
||||||
if ($resp['return_host']) {
|
if ($resp['return_host']) {
|
||||||
foreach ($resp['host'] as $h) {
|
foreach ($resp['host'] as $h) {
|
||||||
$writer->writeElement('domain:host', $h);
|
$writer->writeElement('domain:host', $h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$writer->writeElement('domain:clID', $resp['clID']);
|
$writer->writeElement('domain:clID', $resp['clID']);
|
||||||
if (isset($resp['crID'])) {
|
if (isset($resp['crID'])) {
|
||||||
$writer->writeElement('domain:crID', $resp['crID']);
|
$writer->writeElement('domain:crID', $resp['crID']);
|
||||||
|
@ -747,11 +747,12 @@ class EppWriter {
|
||||||
$writer->endElement(); // End of 'domain:infData'
|
$writer->endElement(); // End of 'domain:infData'
|
||||||
$writer->endElement(); // End of 'resData'
|
$writer->endElement(); // End of 'resData'
|
||||||
|
|
||||||
// Handling the extension part
|
// Begin the extension part if any of the extensions are present
|
||||||
// Check if the 'rgpstatus' key is set in $resp
|
if (isset($resp['rgpstatus']) || isset($resp['secDNS'])) {
|
||||||
if (isset($resp['rgpstatus'])) {
|
|
||||||
// Handling the extension part
|
|
||||||
$writer->startElement('extension');
|
$writer->startElement('extension');
|
||||||
|
|
||||||
|
// Handle RGP status
|
||||||
|
if (isset($resp['rgpstatus'])) {
|
||||||
$writer->startElement('rgp:infData');
|
$writer->startElement('rgp:infData');
|
||||||
$writer->writeAttribute('xmlns:rgp', 'urn:ietf:params:xml:ns:rgp-1.0');
|
$writer->writeAttribute('xmlns:rgp', 'urn:ietf:params:xml:ns:rgp-1.0');
|
||||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd');
|
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd');
|
||||||
|
@ -759,6 +760,49 @@ class EppWriter {
|
||||||
$writer->writeAttribute('s', $resp['rgpstatus']);
|
$writer->writeAttribute('s', $resp['rgpstatus']);
|
||||||
$writer->endElement(); // End of 'rgp:rgpStatus'
|
$writer->endElement(); // End of 'rgp:rgpStatus'
|
||||||
$writer->endElement(); // End of 'rgp:infData'
|
$writer->endElement(); // End of 'rgp:infData'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle secDNS
|
||||||
|
if (isset($resp['secDNS'])) {
|
||||||
|
$writer->startElement('secDNS:infData');
|
||||||
|
$writer->writeAttribute('xmlns:secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1');
|
||||||
|
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd');
|
||||||
|
|
||||||
|
// maxsiglife
|
||||||
|
if (isset($resp['secDNS'][0]['maxSigLife'])) {
|
||||||
|
$writer->writeElement('secDNS:maxSigLife', $resp['secDNS'][0]['maxSigLife']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle secdns records
|
||||||
|
foreach ($resp['secDNS'] as $secData) {
|
||||||
|
// Start the DS data section
|
||||||
|
if (isset($secData['keyTag'])) {
|
||||||
|
$writer->startElement('secDNS:dsData');
|
||||||
|
|
||||||
|
$writer->writeElement('secDNS:keyTag', $secData['keyTag']);
|
||||||
|
$writer->writeElement('secDNS:alg', $secData['alg']);
|
||||||
|
$writer->writeElement('secDNS:digestType', $secData['digestType']);
|
||||||
|
$writer->writeElement('secDNS:digest', $secData['digest']);
|
||||||
|
|
||||||
|
// If keyData is present, nest it inside the current dsData section
|
||||||
|
if (isset($secData['keyData']) && is_array($secData['keyData'])) {
|
||||||
|
$writer->startElement('secDNS:keyData');
|
||||||
|
|
||||||
|
$writer->writeElement('secDNS:flags', $secData['keyData']['flags']);
|
||||||
|
$writer->writeElement('secDNS:protocol', $secData['keyData']['protocol']);
|
||||||
|
$writer->writeElement('secDNS:alg', $secData['keyData']['alg']);
|
||||||
|
$writer->writeElement('secDNS:pubKey', $secData['keyData']['pubKey']);
|
||||||
|
|
||||||
|
$writer->endElement(); // End of 'secDNS:keyData'
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer->endElement(); // End of 'secDNS:dsData'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer->endElement(); // End of 'secDNS:infData'
|
||||||
|
}
|
||||||
|
|
||||||
$writer->endElement(); // End of 'extension'
|
$writer->endElement(); // End of 'extension'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,10 +211,16 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
$hosts = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$hosts = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$transformedHosts = [];
|
$transformedHosts = [];
|
||||||
foreach ($hosts as $host) {
|
if ($hosts) {
|
||||||
$transformedHosts[] = [getHost($db, $host['host_id'])];
|
foreach ($hosts as $host) {
|
||||||
|
$transformedHosts[] = [getHost($db, $host['host_id'])];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare("SELECT name FROM host WHERE domain_id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
$hostNames = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
// Fetch authInfo
|
// Fetch authInfo
|
||||||
$stmt = $db->prepare("SELECT * FROM domain_authInfo WHERE domain_id = :id");
|
$stmt = $db->prepare("SELECT * FROM domain_authInfo WHERE domain_id = :id");
|
||||||
$stmt->execute(['id' => $domain['id']]);
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
@ -230,6 +236,45 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
$statusArray[] = [$status['status']];
|
$statusArray[] = [$status['status']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch secDNS data
|
||||||
|
$stmt = $db->prepare("SELECT * FROM secdns WHERE domain_id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
$secDnsRecords = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$transformedSecDnsRecords = [];
|
||||||
|
if ($secDnsRecords) {
|
||||||
|
foreach ($secDnsRecords as $record) {
|
||||||
|
$tmpRecord = [
|
||||||
|
'keyTag' => $record['keytag'],
|
||||||
|
'alg' => $record['alg'],
|
||||||
|
'digestType' => $record['digesttype'],
|
||||||
|
'digest' => $record['digest']
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add optional fields if they are not null
|
||||||
|
if (!is_null($record['maxsiglife'])) {
|
||||||
|
$tmpRecord['maxSigLife'] = $record['maxsiglife'];
|
||||||
|
}
|
||||||
|
if (!is_null($record['flags'])) {
|
||||||
|
$tmpRecord['keyData']['flags'] = $record['flags'];
|
||||||
|
}
|
||||||
|
if (!is_null($record['protocol'])) {
|
||||||
|
$tmpRecord['keyData']['protocol'] = $record['protocol'];
|
||||||
|
}
|
||||||
|
if (!is_null($record['keydata_alg'])) {
|
||||||
|
$tmpRecord['keyData']['alg'] = $record['keydata_alg'];
|
||||||
|
}
|
||||||
|
if (!is_null($record['pubkey'])) {
|
||||||
|
$tmpRecord['keyData']['pubKey'] = $record['pubkey'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$transformedSecDnsRecords[] = $tmpRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch RGP status
|
||||||
|
$rgpstatus = isset($domain['rgpstatus']) && $domain['rgpstatus'] ? $domain['rgpstatus'] : null;
|
||||||
|
|
||||||
$svTRID = generateSvTRID();
|
$svTRID = generateSvTRID();
|
||||||
$response = [
|
$response = [
|
||||||
'command' => 'info_domain',
|
'command' => 'info_domain',
|
||||||
|
@ -242,18 +287,44 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'registrant' => $domain['registrant'],
|
'registrant' => $domain['registrant'],
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'hostObj' => $transformedHosts,
|
|
||||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||||
'crDate' => $domain['crdate'],
|
'crDate' => $domain['crdate'],
|
||||||
'upID' => getRegistrarClid($db, $domain['upid']),
|
|
||||||
'upDate' => $domain['update'],
|
|
||||||
'exDate' => $domain['exdate'],
|
'exDate' => $domain['exdate'],
|
||||||
'trDate' => $domain['trdate'],
|
|
||||||
'authInfo' => 'valid',
|
'authInfo' => 'valid',
|
||||||
'authInfo_type' => $authInfo['authtype'],
|
'authInfo_type' => $authInfo['authtype'],
|
||||||
'authInfo_val' => $authInfo['authinfo']
|
'authInfo_val' => $authInfo['authinfo']
|
||||||
];
|
];
|
||||||
|
// Conditionally add upID, upDate, and trDate to the response
|
||||||
|
if (isset($domain['upid']) && $domain['upid']) {
|
||||||
|
$response['upID'] = getRegistrarClid($db, $domain['upid']);
|
||||||
|
}
|
||||||
|
if (isset($domain['update']) && $domain['update']) {
|
||||||
|
$response['upDate'] = $domain['update'];
|
||||||
|
}
|
||||||
|
if (isset($domain['trdate']) && $domain['trdate']) {
|
||||||
|
$response['trDate'] = $domain['trdate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conditionally add hostObj if hosts are available from domain_host_map
|
||||||
|
if (!empty($transformedHosts)) {
|
||||||
|
$response['hostObj'] = $transformedHosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conditionally add hostName if hosts are available from host
|
||||||
|
if (!empty($hostNames)) {
|
||||||
|
$response['host'] = $hostNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add secDNS records to response if they exist
|
||||||
|
if ($transformedSecDnsRecords) {
|
||||||
|
$response['secDNS'] = $transformedSecDnsRecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add RGP status to response if it exists
|
||||||
|
if ($rgpstatus) {
|
||||||
|
$response['rgpstatus'] = $rgpstatus;
|
||||||
|
}
|
||||||
|
|
||||||
$epp = new EPP\EppWriter();
|
$epp = new EPP\EppWriter();
|
||||||
$xml = $epp->epp_writer($response);
|
$xml = $epp->epp_writer($response);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue