Moodle
  1. Moodle
  2. MDL-10214

Mnet : wrong error message "Your IP address does not match..." for test client

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.8.1
    • Fix Version/s: 1.8.4, 1.9, 2.0
    • Component/s: MNet
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      29382

      Description

      Wrong error message in log file while trying out mnet/testclient.php when remote_wwwroot is not set in the XML that the client sent.
      XMLRPC Error Response 7017 Your IP address does not match the address we have on record. in /applis/Internet/MOODLE_17_DEV/mnet/xmlrpc/server.php on line 286
      The right message should be:
      XMLRPC Error Response 7020 [[wrong-wwwroot]] in /applis/Internet/MOODLE_17_DEV/mnet/xmlrpc/server.php on line 286

      It's because:

      • record "All Hosts" exists in mnet_host table ; with wwwroot logically not set
      • function set_wwwroot of mnet/peer.php get this record when looking for an EMPTY remote_wwwroot
      • function mnet_server_strip_wrappers of mnet/xmlrpc/server.php believes that this host exists:
        $host_record_exists = $MNET_REMOTE_CLIENT->set_wwwroot($crypt_parser->remote_wwwroot);
      • there is logically no IP address for "All hosts" therefore that doesn't match with the IP of the client which sent the XML

      Here is a very simple fix:
      Index: server.php
      ===================================================================
      RCS file: /cvsroot/moodle/moodle/mnet/xmlrpc/server.php,v
      retrieving revision 1.10.2.1
      diff -u -r1.10.2.1 server.php
      — server.php 20 Feb 2007 02:05:31 -0000 1.10.2.1
      +++ server.php 21 Jun 2007 09:29:08 -0000
      @@ -122,7 +122,11 @@
      $crypt_parser->parse($HTTP_RAW_POST_DATA);

      // Make sure we know who we're talking to

      • $host_record_exists = $MNET_REMOTE_CLIENT->set_wwwroot($crypt_parser->remote_wwwroot);
        + if (empty($crypt_parser->remote_wwwroot)) { + $host_record_exists = false; + }

        else

        { + $host_record_exists = $MNET_REMOTE_CLIENT->set_wwwroot($crypt_parser->remote_wwwroot); + }

      if (false == $host_record_exists) {
      exit(mnet_server_fault(7020, 'wrong-wwwroot', $crypt_parser->remote_wwwroot));

        Activity

        Hide
        Donal McMullan added a comment -

        Hi Arnaud - the old testclient.php was really buggy - I hadn't kept it up to date with the API. I thought testclient.php maybe wasn't very useful, so I rewrote it as a remote-service browser. There's not much of the old code in there anymore, and I'm pretty certain this issue will be fixed by changes I've committed in the last couple of days.

        Now you can click on a host and drill down into the services and methods that it is publishing to your host. You can see the method profiles and descriptions (taken from the methods' docblocks).

        I hope you consider this an improvement!

        Show
        Donal McMullan added a comment - Hi Arnaud - the old testclient.php was really buggy - I hadn't kept it up to date with the API. I thought testclient.php maybe wasn't very useful, so I rewrote it as a remote-service browser. There's not much of the old code in there anymore, and I'm pretty certain this issue will be fixed by changes I've committed in the last couple of days. Now you can click on a host and drill down into the services and methods that it is publishing to your host. You can see the method profiles and descriptions (taken from the methods' docblocks). I hope you consider this an improvement!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: