-
Bug
-
Resolution: Fixed
-
Major
-
3.2.1
-
MOODLE_32_STABLE
-
MOODLE_32_STABLE
-
MDL-58038-master-3 -
in Email -> Outbound config -> Allowed email domains, if one add a couple of allowed domains, say, '*.example.com', 'example.com', each on the new line, then the 'is_domain_in_allowed_list' function fails due to regex match error.
Example of the $alloweddomains array, where elements are separated by line breaks. The check will fail for all domains except the last one.
array(2) { [0]=> string(14) "*.example.com " [1]=> string(11) "example.com" }
|
array(5) { [0]=> string(10) "gmail.com " [1]=> string(7) "kth.se " [2]=> string(6) "su.se " [3]=> string(11) "hotmail.com" }
|
and this is what is saved in DB for CFG->allowedemaildomains:
gmail.com\r\nkth.se\r\nsu.se\r\nhotmail.com
|
When looking at the source, it is clear that exploding function did not delete all line breaks, so it is still there for all domains except last one. Because of this, is_domain_matching_pattern fires FALSE for '*.example.com ". The latter will be working though.
This seems to be system-dependent, so here is my set up: Apache/2.4.23 (Unix) PHP/5.6.28
On the screenshot attached, the string stands for CFG->allowedemaildomains, while array is the result of exploding that string by PHP_EOL.
- has been marked as being related by
-
MDL-58057 Config values not properly cleaned in curl_security_helper
- Closed
-
MDL-58517 ip_utils::is_domain_in_allowed_list does not trim
- Closed
- has to be done before
-
MDL-58054 'Hide my email' should not hide real email from notifications to users with 'viewuseridentity' capability
- Open