-
Bug
-
Resolution: Fixed
-
Critical
-
2.5.2, 2.6, 2.7.3, 2.8.1
-
MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-43987-master -
-
BACKEND Sprint 18
This following issue is preventing recaptcha from working on my site however I have tracked down the problem to being a general issue in the /lib/moodlelib.php function library.
When the getremoteaddr() function is called to get the remote IP address, the SERVER[HTTP_X_FORWARDED_FOR] variable is set because my Moodle site sitting behind a firewall. The problem is, the value returned includes a colon followed by a port number. Example:
201.18.234.2:59209
When the cleanremoteaddr() function sees a colon in an IP address, it incorrectly assumes this is an IPv6 address.
You can test this yourself using the function as follows:
echo cleanremoteaddr("201.18.234.2:59209");
The desired result should be the display of "201.18.234.2". Instead, the function fails validation of the IP address.
The check to determine whether an address is IPv4 or IPv6 should be determined by whether there is less than 2 colons or more than 2 colons, not just one colon.
- caused a regression
-
MDL-48587 php exception because of the wrong version
-
- Closed
-