Skip to content

Commit

Permalink
MDL-29396 core: ip blocking will be bypassed for cli scripts - Thanks…
Browse files Browse the repository at this point in the history
… Petr
  • Loading branch information
Rajesh Taneja committed Nov 22, 2011
1 parent cf04ce3 commit a7371c4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,12 +808,14 @@ function stripslashes_deep($value) {
}
}

// in the first case, ip in allowed list will be performed first
// for example, client IP is 192.168.1.1
// 192.168 subnet is an entry in allowed list
// 192.168.1.1 is banned in blocked list
// This ip will be banned finally
if (!empty($CFG->allowbeforeblock)) { // allowed list processed before blocked list?
if (CLI_SCRIPT and !defined('WEB_CRON_EMULATED_CLI') and !PHPUNIT_SCRIPT) {
// no ip blocking
} else if (!empty($CFG->allowbeforeblock)) { // allowed list processed before blocked list?
// in this case, ip in allowed list will be performed first
// for example, client IP is 192.168.1.1
// 192.168 subnet is an entry in allowed list
// 192.168.1.1 is banned in blocked list
// This ip will be banned finally
if (!empty($CFG->allowedip)) {
if (!remoteip_in_list($CFG->allowedip)) {
die(get_string('ipblocked', 'admin'));
Expand Down

0 comments on commit a7371c4

Please sign in to comment.