public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] allow "*" as wildcard domain
ed4dcff6
data/web/inc/functions.inc.php | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
Diff
diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php
index 2631f121..bb2d35ea 100644
--- a/data/web/inc/functions.inc.php
+++ b/data/web/inc/functions.inc.php
@@ -1115,11 +1115,15 @@ function is_valid_domain_name($domain_name, $options = array()) {
// Convert domain name to ASCII for validation
$domain_name = idn_to_ascii($domain_name, 0, INTL_IDNA_VARIANT_UTS46);
- // Remove '*.' if wildcard subdomains are allowed
- if (isset($options['allow_wildcard']) &&
- $options['allow_wildcard'] == true &&
- strpos($domain_name, '*.') === 0) {
- $domain_name = substr($domain_name, 2);
+ if (isset($options['allow_wildcard']) && $options['allow_wildcard'] == true) {
+ // Remove '*.' if wildcard domains are allowed
+ if (strpos($domain_name, '*.') === 0) {
+ $domain_name = substr($domain_name, 2);
+ }
+ // Allow '*' as wildcard domain
+ if ($domain_name === "*") {
+ return true;
+ }
}
return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name)