mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-02 00:53:22 +02:00
Fixes #5
This commit is contained in:
parent
1f7bdb8c64
commit
40e2b1ab54
1 changed files with 42 additions and 15 deletions
|
@ -172,6 +172,13 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
||||||
$clTRID = (string) $xml->command->clTRID;
|
$clTRID = (string) $xml->command->clTRID;
|
||||||
|
|
||||||
|
$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
|
||||||
|
if (!empty($result)) {
|
||||||
|
$authInfo_pw = (string)$result[0];
|
||||||
|
} else {
|
||||||
|
$authInfo_pw = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Validation for domain name
|
// Validation for domain name
|
||||||
$invalid_label = validate_label($domainName, $db);
|
$invalid_label = validate_label($domainName, $db);
|
||||||
if ($invalid_label) {
|
if ($invalid_label) {
|
||||||
|
@ -195,6 +202,17 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($authInfo_pw) {
|
||||||
|
$stmt = $db->prepare("SELECT id FROM domain_authInfo WHERE domain_id = ? AND authtype = 'pw' AND authinfo = ? LIMIT 1");
|
||||||
|
$stmt->execute([$domain['id'], $authInfo_pw]);
|
||||||
|
$domain_authinfo_id = $stmt->fetchColumn();
|
||||||
|
|
||||||
|
if (!$domain_authinfo_id) {
|
||||||
|
sendEppError($conn, $db, 2202, 'authInfo pw is not correct', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch contacts
|
// Fetch contacts
|
||||||
$stmt = $db->prepare("SELECT * FROM domain_contact_map WHERE domain_id = :id");
|
$stmt = $db->prepare("SELECT * FROM domain_contact_map WHERE domain_id = :id");
|
||||||
$stmt->execute(['id' => $domain['id']]);
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
@ -241,6 +259,11 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
$stmt->execute(['id' => $domain['id']]);
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
$secDnsRecords = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$secDnsRecords = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Fetch registrant identifier
|
||||||
|
$stmt = $db->prepare("SELECT identifier FROM contact WHERE id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['registrant']]);
|
||||||
|
$registrant_id = $stmt->fetch(PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
$transformedSecDnsRecords = [];
|
$transformedSecDnsRecords = [];
|
||||||
if ($secDnsRecords) {
|
if ($secDnsRecords) {
|
||||||
foreach ($secDnsRecords as $record) {
|
foreach ($secDnsRecords as $record) {
|
||||||
|
@ -285,15 +308,12 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
'name' => $domain['name'],
|
'name' => $domain['name'],
|
||||||
'roid' => 'D' . $domain['id'],
|
'roid' => 'D' . $domain['id'],
|
||||||
'status' => $statusArray,
|
'status' => $statusArray,
|
||||||
'registrant' => $domain['registrant'],
|
'registrant' => $registrant_id,
|
||||||
'contact' => $transformedContacts,
|
'contact' => $transformedContacts,
|
||||||
'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'],
|
||||||
'exDate' => $domain['exdate'],
|
'exDate' => $domain['exdate']
|
||||||
'authInfo' => 'valid',
|
|
||||||
'authInfo_type' => $authInfo['authtype'],
|
|
||||||
'authInfo_val' => $authInfo['authinfo']
|
|
||||||
];
|
];
|
||||||
// Conditionally add upID, upDate, and trDate to the response
|
// Conditionally add upID, upDate, and trDate to the response
|
||||||
if (isset($domain['upid']) && $domain['upid']) {
|
if (isset($domain['upid']) && $domain['upid']) {
|
||||||
|
@ -305,6 +325,13 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
if (isset($domain['trdate']) && $domain['trdate']) {
|
if (isset($domain['trdate']) && $domain['trdate']) {
|
||||||
$response['trDate'] = $domain['trdate'];
|
$response['trDate'] = $domain['trdate'];
|
||||||
}
|
}
|
||||||
|
if (isset($domain_authinfo_id) && $domain_authinfo_id) {
|
||||||
|
$response['authInfo'] = 'valid';
|
||||||
|
$response['authInfo_type'] = $authInfo['authtype'];
|
||||||
|
$response['authInfo_val'] = $authInfo['authinfo'];
|
||||||
|
} else {
|
||||||
|
$response['authInfo'] = 'invalid';
|
||||||
|
}
|
||||||
|
|
||||||
// Conditionally add hostObj if hosts are available from domain_host_map
|
// Conditionally add hostObj if hosts are available from domain_host_map
|
||||||
if (!empty($transformedHosts)) {
|
if (!empty($transformedHosts)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue