]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11904 deny/accept Email settings conflict with text - now .example.com means...
authorskodak <skodak>
Mon, 29 Oct 2007 20:04:14 +0000 (20:04 +0000)
committerskodak <skodak>
Mon, 29 Oct 2007 20:04:14 +0000 (20:04 +0000)
lib/moodlelib.php

index ed5fe40881cf6f8f95f895ee9422b612ac51410e..3371cb52327babb89d72e81038bac7d334071713 100644 (file)
@@ -4050,7 +4050,13 @@ function email_is_not_allowed($email) {
             if (!$allowedpattern) {
                 continue;
             }
-            if (strpos(strrev($email), strrev('@'.$allowedpattern)) === 0) { // Match!   (bug 5250)
+            if (strpos($allowedpattern, '.') === 0) {
+                if (strpos(strrev($email), strrev($allowedpattern)) === 0) {
+                    // subdomains are in a form ".example.com" - matches "xxx@anything.example.com"
+                    return false;
+                }
+
+            } else if (strpos(strrev($email), strrev('@'.$allowedpattern)) === 0) { // Match!   (bug 5250)
                 return false;
             }
         }
@@ -4063,7 +4069,13 @@ function email_is_not_allowed($email) {
             if (!$deniedpattern) {
                 continue;
             }
-            if (strpos(strrev($email), strrev('@'.$deniedpattern)) === 0) { // Match!   (bug 5250)
+            if (strpos($deniedpattern, '.') === 0) {
+                if (strpos(strrev($email), strrev($deniedpattern)) === 0) {
+                    // subdomains are in a form ".example.com" - matches "xxx@anything.example.com"
+                    return get_string('emailnotallowed', '', $CFG->denyemailaddresses);
+                }
+
+            } else if (strpos(strrev($email), strrev('@'.$deniedpattern)) === 0) { // Match!   (bug 5250)
                 return get_string('emailnotallowed', '', $CFG->denyemailaddresses);
             }
         }