Moodle

Forum emails being sent with mnet idp rewritten links when mnet is disabled/user is not a roaming user

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.4
  • Fix Version/s: 1.9.5, 2.0
  • Component/s: Forum, MNet
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

We've received various reports of site being sent forum emails with the mnet idp bounce to send them back to their own site (where they then get told mnet is disabled).

Pretty sure this is due to a bad mnethostid check in email_to_user in lib/moodlelib.php:

if ($user->mnethostid > 1) {

And manifests itself where SITEID is no longer 1...

Going to do some more testing then fix in CVS

Activity

Hide
Dan Poltawski added a comment -

Fixed in CVS.

I switched the remote user check to use is_mnet_remote_user() as in the docs here: http://docs.moodle.org/en/Development:Moodle_Network

Peter/Nigel, would be great if you could verify the fix.

thanks

Show
Dan Poltawski added a comment - Fixed in CVS. I switched the remote user check to use is_mnet_remote_user() as in the docs here: http://docs.moodle.org/en/Development:Moodle_Network Peter/Nigel, would be great if you could verify the fix. thanks
Hide
Peter Bulmer added a comment -

your fix sounds suitable to me.

Reading the docs though, it sounds like it's documented backwards:

// a quick way to check if our user is local
is_mnet_remote_user($user);
// internally wis_mnet_remote_user() does
// if ($user->mnethostid == $CFG->mnet_localhost_id)

This documentation makes it sound like if you call is_mnet_remote_user(), passing a local user you'll get TRUE as the result, whereas the name of the function would suggest it ought to return FALSE.

If you've looked at the code recently, and can confirm it actually does what it sounds like it ought to do, can you please correct the docs?

Thanks,
Pete.

Show
Peter Bulmer added a comment - your fix sounds suitable to me. Reading the docs though, it sounds like it's documented backwards: // a quick way to check if our user is local is_mnet_remote_user($user); // internally wis_mnet_remote_user() does // if ($user->mnethostid == $CFG->mnet_localhost_id) This documentation makes it sound like if you call is_mnet_remote_user(), passing a local user you'll get TRUE as the result, whereas the name of the function would suggest it ought to return FALSE. If you've looked at the code recently, and can confirm it actually does what it sounds like it ought to do, can you please correct the docs? Thanks, Pete.
Hide
Dan Poltawski added a comment -

Yeah, i've corrected the docs - heh, funny I sort of skimmed over what the docs actually said!

thanks

Show
Dan Poltawski added a comment - Yeah, i've corrected the docs - heh, funny I sort of skimmed over what the docs actually said! thanks
Hide
Tim Hunt added a comment -

Fix makes sense to me. Thanks.

Show
Tim Hunt added a comment - Fix makes sense to me. Thanks.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: