Project

General

Profile

Feature #20011 ยป 10429.diff

Administrator Admin, 2009-02-13 12:06

View differences:

t3lib/class.t3lib_security.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Dmitry Dulepov <dmitry@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
* $Id: $
*/
/**
* This class provides TYPO3 security functions
*
* @author Dmitry Dulepov <dmitry@typo3.org>
* @package TYPO3
*/
class t3lib_security {
/**
* Locks the install tool after the defined period of time (default: 24h).
*
* @return void
*/
static public function lockInstallTool() {
$disableLock = (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['lockInstallTool']) &&
$GLOBALS['TYPO3_CONF_VARS']['SYS']['lockInstallTool']);
if (!$disableLock) {
$fileName = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL';
if (file_exists($fileName)) {
$lockTimeout = (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['lockInstallTool_timeout']) ?
$GLOBALS['TYPO3_CONF_VARS']['SYS']['lockInstallTool_timeout'] : 24);
if (filemtime($fileName) < time() - $lockTimeout*60*60) {
@unlink($fileName);
}
}
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_security.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_security.php']);
}
?>
typo3/mod/tools/security/cli/class.security_cli.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Dmitry Dulepov <dmitry@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
* $Id: $
*/
if (!defined('TYPO3_cliMode')) {
die('You cannot run this script directly!');
}
require_once(PATH_t3lib . 'class.t3lib_security.php');
/**
* This class implements a security CLI interface
*
* @author Dmitry Dulepov <dmitry@typo3.org>
* @package TYPO3
*/
class security_cli {
/**
* Runs this script
*
* @return void
*/
public function main() {
// Lock the install tool
t3lib_security::lockInstallTool();
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mode/tools/security/cli/class.security_cli.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mode/tools/security/cli/class.security_cli.php']);
}
$module = t3lib_div::makeInstance('security_cli');
$module->main();
?>
typo3/sysext/cms/tslib/index_ts.php (working copy)
if (!defined('PATH_site')) define('PATH_site', dirname(PATH_thisScript).'/');
if (!defined('PATH_t3lib')) define('PATH_t3lib', PATH_site.'t3lib/');
// Lock the Install tool
if ((mt_rand(0, 1000) % 3) == 0) {
require_once(PATH_t3lib . 'class.t3lib_security.php');
t3lib_security::lockInstallTool();
}
define('TYPO3_mainDir', 'typo3/'); // This is the directory of the backend administration for the sites of this TYPO3 installation.
define('PATH_typo3', PATH_site.TYPO3_mainDir);
define('PATH_typo3conf', PATH_site.'typo3conf/');
typo3/index.php (working copy)
define('TYPO3_PROCEED_IF_NO_USER', 1);
require ('init.php');
require ('template.php');
require_once(PATH_t3lib . 'class.t3lib_security.php');
......
/**
* Script Class for rendering the login form
*
......
* @return void
*/
function init() {
// Lock the Install tool
t3lib_security::lockInstallTool();
$this->redirect_url = t3lib_div::_GP('redirect_url');
$this->GPinterface = t3lib_div::_GP('interface');
t3lib/config_default.php (working copy)
$ACCESS_TIME = $EXEC_TIME - ($EXEC_TIME % 60); // $ACCESS_TIME is a common time in minutes for access control
$SIM_ACCESS_TIME = $ACCESS_TIME; // if $SIM_EXEC_TIME is changed this value must be set accordingly
$TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys']['security'] = array(PATH_typo3 . 'mod/tools/security/cli/class.security_cli.php', '_CLI_lowlevel');
?>
    (1-1/1)