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

64 bit support for subnet mask of type 1 in quiz

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.1
    • Fix Version/s: 1.7.6, 1.8.7, 1.9.3
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      64 bit CPU architecture - Linux Intel
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      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

            • Assignee:
              timhunt Tim Hunt
              Reporter:
              dpouliot Daniel Pouliot
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Oct/08