Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-15655

64 bit support for subnet mask of type 1 in quiz

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9.1
    • 1.7.6, 1.8.7, 1.9.3
    • Quiz
    • None
    • 64 bit CPU architecture - Linux Intel
    • MOODLE_19_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      When using quiz restriction by ip address, using range type 1: xxx.xxx.xxx.xxx/xx, on 64 bit CPU, result is unexpected. Add the '+' line :

      +++ lib/moodlelib.php
      @@ -7029,6 +7029,7 @@
      if (strpos($subnet, '/') !== false)

      { /// type 1 list($ip, $mask) = explode('/', $subnet); $mask = 0xffffffff << (32 - $mask); + $mask = substr($mask,0,8); // Compatib. cpu 64 bit $found = ((ip2long($addr) & $mask) == (ip2long($ip) & $mask)); }

      else if (strpos($subnet, '-') !== false) {/// type 3
      $subnetparts = explode('.', $subnet);

      Attachments

        Activity

          People

            timhunt Tim Hunt
            dpouliot Daniel Pouliot
            Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/Oct/08