MDL-9399 auth/ldap: NTLM SSO - Resolve Moodle cookies issue, tighten config.php require()s
Use $nomoodlecookie global to avoid session troubles. Also * Ensure we load the appropriate config.php, even if we are executing under a strange environment (ie: with a user's credentials!) * Test we have a spacer gif to open before we open it
This commit is contained in:
@@ -1765,6 +1765,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
*
|
||||
* NOTE that this code will execute under the OS user credentials,
|
||||
* so we MUST avoid dealing with files -- such as session files.
|
||||
* (The caller should set $nomoodlecookie before including config.php)
|
||||
*
|
||||
*/
|
||||
function ntlmsso_magic($sesskey) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<?php
|
||||
|
||||
// Disable session handling here?
|
||||
require_once("../../config.php");
|
||||
session_write_close();
|
||||
// Don't let lib/setup.php set any cookies
|
||||
// as we will be executing under the OS security
|
||||
// context of the user we are trying to login, rather than
|
||||
// of the webserver.
|
||||
$nomoodlecookie=true;
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__)))."/config.php");
|
||||
|
||||
//HTTPS is potentially required in this page
|
||||
httpsrequired();
|
||||
@@ -18,10 +22,12 @@ if (empty($authplugin->config->ntlmsso_enabled)) {
|
||||
}
|
||||
|
||||
$sesskey = required_param('sesskey', PARAM_RAW);
|
||||
if ($authplugin->ntlmsso_magic($sesskey)) {
|
||||
$file = $CFG->dirroot . '/pix/spacer.gif';
|
||||
|
||||
if ($authplugin->ntlmsso_magic($sesskey)
|
||||
&& file_exists($file)) {
|
||||
|
||||
// Serve GIF
|
||||
$file = $CFG->dirroot . '/pix/spacer.gif';
|
||||
|
||||
// Type
|
||||
header('Content-Type: image/gif');
|
||||
header('Content-Length: '.filesize($file));
|
||||
|
||||
Reference in New Issue
Block a user