mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-06 14:09:52 +01:00
* NTLM authentication: limit redirect, if NTLM auth could not be preformed, to same domain, EGroupware domain, or explicitly whitelisted domains
to fix issue "found" on www.autosectools.com
This commit is contained in:
parent
31c9e8965b
commit
6a1834ceff
@ -7,10 +7,35 @@
|
|||||||
* @package api
|
* @package api
|
||||||
* @subpackage authentication
|
* @subpackage authentication
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @copyright (c) 2008 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2008-2011 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if given domain is either whitelisted, the current one or the EGroupware one
|
||||||
|
*
|
||||||
|
* Used to NOT redirect to arbitrary urls.
|
||||||
|
*
|
||||||
|
* @param string $url full url or just path, later is always allowed, as it stays within the domain
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function check_domain($url)
|
||||||
|
{
|
||||||
|
$whitelisted = array(
|
||||||
|
$_SERVER['HTTP_HOST'], // can contain :port
|
||||||
|
// add additional domains-names (just full qualified hostnames) here
|
||||||
|
|
||||||
|
);
|
||||||
|
if ($GLOBALS['egw_info']['server']['webserver_url'][0] === 'h')
|
||||||
|
{
|
||||||
|
$whitelisted[] = parse_url($GLOBALS['egw_info']['server']['webserver_url'], PHP_URL_HOST);
|
||||||
|
}
|
||||||
|
$parts = parse_url($url);
|
||||||
|
$host = $parts['host'].($parts['port'] ? ':'.$parts['port'] : '');
|
||||||
|
|
||||||
|
return $url[0] == '/' || in_array($host, $whitelisted);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if the given user has access
|
* check if the given user has access
|
||||||
*
|
*
|
||||||
@ -36,7 +61,7 @@ function check_access(&$account)
|
|||||||
}
|
}
|
||||||
if (!$sessionid)
|
if (!$sessionid)
|
||||||
{
|
{
|
||||||
if (isset($_GET['forward']))
|
if (isset($_GET['forward']) && check_domain($_GET['forward']))
|
||||||
{
|
{
|
||||||
header('Location: '.$_GET['forward']);
|
header('Location: '.$_GET['forward']);
|
||||||
}
|
}
|
||||||
@ -57,7 +82,7 @@ $GLOBALS['egw_info']['flags'] = array(
|
|||||||
// if you move this file somewhere else, you need to adapt the path to the header!
|
// if you move this file somewhere else, you need to adapt the path to the header!
|
||||||
include(dirname(__FILE__).'/../../header.inc.php');
|
include(dirname(__FILE__).'/../../header.inc.php');
|
||||||
|
|
||||||
if (isset($_GET['forward']))
|
if (isset($_GET['forward']) && check_domain($_GET['forward']))
|
||||||
{
|
{
|
||||||
$forward = $_GET['forward'];
|
$forward = $_GET['forward'];
|
||||||
$GLOBALS['egw']->session->appsession('referer', 'login', $forward);
|
$GLOBALS['egw']->session->appsession('referer', 'login', $forward);
|
||||||
|
Loading…
Reference in New Issue
Block a user