mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 17:16:59 +02:00
Many fixes in epp create, renew, transfer
This commit is contained in:
parent
dd6ec728cc
commit
67f9651a8a
4 changed files with 32 additions and 9 deletions
|
@ -611,9 +611,16 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
}
|
||||
|
||||
$periodElements = $xml->xpath("//domain:create/domain:period");
|
||||
$periodElement = $periodElements[0];
|
||||
$period = (int) $periodElement;
|
||||
$period_unit = (string) $periodElement['unit'];
|
||||
|
||||
if (!empty($periodElements)) {
|
||||
$periodElement = $periodElements[0];
|
||||
$period = (int) $periodElement;
|
||||
$period_unit = (string) $periodElement['unit'];
|
||||
} else {
|
||||
$periodElement = null;
|
||||
$period = null;
|
||||
$period_unit = null;
|
||||
}
|
||||
|
||||
if ($period && (($period < 1) || ($period > 99))) {
|
||||
sendEppError($conn, $db, 2004, 'domain:period minLength value=1, maxLength value=99', $clTRID, $trans);
|
||||
|
@ -623,7 +630,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
}
|
||||
|
||||
if ($period_unit) {
|
||||
if (!preg_match('/^(m|y)$/', $period_unit)) {
|
||||
if (!preg_match('/^(m|y)$/i', $period_unit)) {
|
||||
sendEppError($conn, $db, 2004, 'domain:period unit m|y', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
@ -996,7 +1003,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
}
|
||||
}
|
||||
|
||||
$authInfo_pw = $xml->xpath('//domain:authInfo/domain:pw[1]')[0] ?? null;
|
||||
$authInfo_pw = (string) $xml->xpath('//domain:authInfo/domain:pw[1]')[0] ?? null;
|
||||
|
||||
if (!$authInfo_pw) {
|
||||
sendEppError($conn, $db, 2003, 'Missing domain:pw', $clTRID, $trans);
|
||||
|
|
|
@ -4,9 +4,15 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
$domainName = (string) $xml->command->renew->children('urn:ietf:params:xml:ns:domain-1.0')->renew->name;
|
||||
$curExpDate = (string) $xml->command->renew->children('urn:ietf:params:xml:ns:domain-1.0')->renew->curExpDate;
|
||||
$periodElements = $xml->xpath("//domain:renew/domain:period");
|
||||
$periodElement = $periodElements[0];
|
||||
$period = (int) $periodElement;
|
||||
$periodUnit = (string) $periodElement['unit'];
|
||||
if (!empty($periodElements)) {
|
||||
$periodElement = $periodElements[0];
|
||||
$period = (int) $periodElement;
|
||||
$periodUnit = (string) $periodElement['unit'];
|
||||
} else {
|
||||
$periodElement = null;
|
||||
$period = null;
|
||||
$periodUnit = null;
|
||||
}
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
if (!$domainName) {
|
||||
|
@ -19,13 +25,17 @@ function processDomainRenew($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
sendEppError($conn, $db, 2004, "domain:period minLength value='1', maxLength value='99'");
|
||||
return;
|
||||
}
|
||||
} elseif (!$period) {
|
||||
$period = 1;
|
||||
}
|
||||
|
||||
if ($periodUnit) {
|
||||
if (!preg_match("/^(m|y)$/", $periodUnit)) {
|
||||
if (!preg_match('/^(m|y)$/i', $periodUnit)) {
|
||||
sendEppError($conn, $db, 2004, "domain:period unit m|y");
|
||||
return;
|
||||
}
|
||||
} elseif (!$periodUnit) {
|
||||
$period = 'y';
|
||||
}
|
||||
|
||||
$stmt = $db->prepare("SELECT id FROM registrar WHERE clid = :clid LIMIT 1");
|
||||
|
|
|
@ -835,6 +835,7 @@ function processDomainTransfer($conn, $db, $xml, $clid, $database_type, $trans)
|
|||
}
|
||||
|
||||
if ($period_unit) {
|
||||
$period_unit = strtolower($period_unit);
|
||||
if (!in_array($period_unit, ['m', 'y'])) {
|
||||
sendEppError($conn, $db, 2004, 'domain:period unit m|y', $clTRID, $trans);
|
||||
return;
|
||||
|
|
|
@ -228,6 +228,11 @@ function createTransaction($db, $clid, $clTRID, $clTRIDframe) {
|
|||
$cldate = date("Y-m-d H:i:s", $dateForClTransaction);
|
||||
$clmicrosecond = sprintf("%06d", ($dateForClTransaction - floor($dateForClTransaction)) * 1000000);
|
||||
|
||||
if (empty($clTRID)) {
|
||||
// If $clTRID is empty, generate a random string prefixed with "client-not-provided-"
|
||||
$clTRID = 'client-not-provided-' . bin2hex(random_bytes(8)); // Generates a 16 character hexadecimal string
|
||||
}
|
||||
|
||||
// Execute the statement
|
||||
if (!$stmt->execute([
|
||||
$clid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue