Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#817: sp/module.php references a file that no longer exists #827

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

Limekiller
Copy link
Contributor

This is a fix for #817. We have a client that, after updating auth_saml2 to the latest version available on the plugin directory for 4.3, was receiving the following error:

Exception - Failed opening required '[dirroot]/auth/saml2/.extlib/simplesamlphp/www/module.php' (include_path='[dirroot]/lib/pear:.:/usr/share/php')

The www/module.php file no longer exists in the included version of simplesamlphp, and as discovered by the issue filer, has been replaced by public/module.php. After replacing the reference in sp/module.php, we received a new error:

SimpleSAMLphp
Unhandled exception
An unhandled exception was thrown.
If you report this error, please also report this tracking number which makes it possible to locate your session in the logs available to the system administrator:

b2924b4297

Debug information
The debug information below may be of interest to the administrator / help desk:

SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
Backtrace:
1 public/_include.php:28 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: SimpleSAML\Assert\AssertionFailedException: .../moodle-4.3/auth/saml2/config/config.php: Could not retrieve the required option 'tempdir'.
...

It appeared that the simplesamlphp library was looking for a "tempdir" config setting, which wasn't included in config/config.php. After adding said value, the login flow was working again. We set the value to /tmp/simplesaml, but there may be a better default.

Copy link

@mitchell-accipio mitchell-accipio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to solve the reported issue

Copy link
Contributor

@keevan keevan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Limekiller. Thanks for making these changes. They look correct.

The path did change to public/ (from www) and including the tempdir configuration option did resolve the immediate problem locally when I tested it.

Are you able to, similar to other saml2 configuration options, expose the option via a new setting? You can copy the pattern used for the logdir option (mapping to loggingdir in simplesaml2), which should prevent it breaking for environments which don't use the default /tmp path (e.g. Windows)

See snippets below

'loggingdir' => $saml2auth->config->logdir,

'logdir' => '/tmp/',

$settings->add(new admin_setting_configtext(
'auth_saml2/logdir',
get_string('logdir', 'auth_saml2'),
get_string('logdir_help', 'auth_saml2'),
get_string('logdirdefault', 'auth_saml2'),
PARAM_TEXT));

@Limekiller
Copy link
Contributor Author

@keevan Ok, I've made the requested changes to make the directory a config setting. Please take a look and let me know if I need to make further changes.

Copy link
Contributor

@keevan keevan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the failing CI (known issue) this looks good to be merged.

Thanks for your contributions @Limekiller

@keevan keevan merged commit b622433 into catalyst:MOODLE_39_STABLE Nov 6, 2024
13 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants