lowercase domainnames when adding new (sub)domain to avoid issues with certificates on filesystem

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-12-11 20:12:51 +01:00
parent 466c09137b
commit 63d915804a
4 changed files with 7 additions and 5 deletions

View File

@@ -354,7 +354,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
}
// validation
if ($p_domain == Settings::Get('system.hostname')) {
$p_domain = strtolower($p_domain);
if ($p_domain == strtolower(Settings::Get('system.hostname'))) {
\Froxlor\UI\Response::standard_error('admin_domain_emailsystemhostname', '', true);
}

View File

@@ -99,6 +99,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$customer = $this->getCustomerData('subdomains');
// validation
$subdomain = strtolower($subdomain);
if (substr($subdomain, 0, 4) == 'xn--') {
\Froxlor\UI\Response::standard_error('domain_nopunycode', '', true);
}
@@ -118,7 +119,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
'mydomain'
), '', true);
}
if ($completedomain == Settings::Get('system.hostname')) {
if ($completedomain == strtolower(Settings::Get('system.hostname'))) {
\Froxlor\UI\Response::standard_error('admin_domain_emailsystemhostname', '', true);
}

View File

@@ -26,7 +26,7 @@ class DomainsTest extends TestCase
))->get();
$customer_userdata = json_decode($json_result, true)['data'];
$data = [
'domain' => 'test.local',
'domain' => 'TEST.local',
'customerid' => $customer_userdata['customerid'],
'override_tls' => 1,
'ssl_protocols' => array(

View File

@@ -28,7 +28,7 @@ class SubDomainsTest extends TestCase
$customer_userdata = json_decode($json_result, true)['data'];
$data = [
'subdomain' => 'mysub',
'subdomain' => 'mySub',
'domain' => 'test2.local'
];
$json_result = SubDomains::getLocal($customer_userdata, $data)->add();
@@ -47,7 +47,7 @@ class SubDomainsTest extends TestCase
$reseller_userdata['adminsession'] = 1;
$data = [
'subdomain' => 'mysub2',
'subdomain' => 'mySub2',
'domain' => 'test2.local',
'customerid' => 1
];