This commit is contained in:
Roland Gruber 2016-01-02 13:39:28 +00:00
parent 38f52e6a98
commit 7c0cada014
4 changed files with 25 additions and 25 deletions

View File

@ -230,7 +230,7 @@ function deleteConfigProfile($name) {
} }
} }
// delete config file // delete config file
$confFile = $dir . $_POST['delfilename'] . ".conf"; $confFile = $dir . $name . ".conf";
if (!@unlink($confFile)) { if (!@unlink($confFile)) {
logNewMessage(LOG_ERR, 'Unable to delete ' . $confFile); logNewMessage(LOG_ERR, 'Unable to delete ' . $confFile);
return _("Unable to delete profile!"); return _("Unable to delete profile!");
@ -386,7 +386,7 @@ class LAMLanguage {
} }
/** /**
* This class manages .conf files. * This class manages conf files.
* *
* @package configuration * @package configuration
*/ */

View File

@ -1,3 +1,4 @@
<?php
/* /*
$Id$ $Id$
@ -19,14 +20,13 @@ $Id$
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
<?php
include_once (dirname ( __FILE__ ) . '/../../../lib/baseModule.inc'); include_once (dirname ( __FILE__ ) . '/../../../lib/baseModule.inc');
include_once (dirname ( __FILE__ ) . '/../../../lib/modules/sudoRole.inc'); include_once (dirname ( __FILE__ ) . '/../../../lib/modules/sudoRole.inc');
/** /**
* Checks sudo role functions. * Checks sudo role functions.
* *
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
@ -43,7 +43,7 @@ class SudoRoleTest extends PHPUnit_Framework_TestCase {
$this->assertNotTrue(sudoRole::isValidDate($testDate), $testDate); $this->assertNotTrue(sudoRole::isValidDate($testDate), $testDate);
} }
} }
public function testEncodeDate() { public function testEncodeDate() {
$dates = array( $dates = array(
'1.2.2014' => '20140201000000Z', '1.2.2014' => '20140201000000Z',
@ -59,7 +59,7 @@ class SudoRoleTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($output, sudoRole::encodeDate($input), $input . ' ' . $output); $this->assertEquals($output, sudoRole::encodeDate($input), $input . ' ' . $output);
} }
} }
public function testDecodeDate() { public function testDecodeDate() {
$dates = array( $dates = array(
'01.02.2014 00:00' => '20140201000000Z', '01.02.2014 00:00' => '20140201000000Z',
@ -75,7 +75,7 @@ class SudoRoleTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($output, sudoRole::decodeDate($input), $input . ' ' . $output); $this->assertEquals($output, sudoRole::decodeDate($input), $input . ' ' . $output);
} }
} }
} }
?> ?>

View File

@ -1,3 +1,4 @@
<?php
/* /*
$Id$ $Id$
@ -19,7 +20,6 @@ $Id$
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
<?php
$_SERVER ['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER ['REMOTE_ADDR'] = '127.0.0.1';
@ -28,50 +28,50 @@ include_once (dirname ( __FILE__ ) . '/../../lib/security.inc');
/** /**
* Checks password checking functions. * Checks password checking functions.
* *
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class SecurityTest extends PHPUnit_Framework_TestCase { class SecurityTest extends PHPUnit_Framework_TestCase {
private $cfg = null; private $cfg = null;
protected function setUp() { protected function setUp() {
testCreateDefaultConfig (); testCreateDefaultConfig ();
$this->cfg = &$_SESSION ['cfgMain']; $this->cfg = &$_SESSION ['cfgMain'];
$this->resetPasswordRules(); $this->resetPasswordRules();
} }
public function testMinLength() { public function testMinLength() {
$this->cfg->passwordMinLength = 5; $this->cfg->passwordMinLength = 5;
$this->checkPwd(array('55555', '666666'), array('1', '22', '333', '4444')); $this->checkPwd(array('55555', '666666'), array('1', '22', '333', '4444'));
} }
public function testMinUpper() { public function testMinUpper() {
$this->cfg->passwordMinUpper = 3; $this->cfg->passwordMinUpper = 3;
$this->checkPwd(array('55A5AA55', '6BB666BB66', 'ABC'), array ('1A', '2C2C', 'AB3', '44BB')); $this->checkPwd(array('55A5AA55', '6BB666BB66', 'ABC'), array ('1A', '2C2C', 'AB3', '44BB'));
} }
public function testMinLower() { public function testMinLower() {
$this->cfg->passwordMinLower = 3; $this->cfg->passwordMinLower = 3;
$this->checkPwd(array('55a5aa55', '6bb666bb66', 'abc'), array ('1a', '2c2c', 'ab3', '44bbABC')); $this->checkPwd(array('55a5aa55', '6bb666bb66', 'abc'), array ('1a', '2c2c', 'ab3', '44bbABC'));
} }
public function testMinNumeric() { public function testMinNumeric() {
$this->cfg->passwordMinNumeric = 3; $this->cfg->passwordMinNumeric = 3;
$this->checkPwd(array('333', '4444'), array('1', '22', '33A', '44bb')); $this->checkPwd(array('333', '4444'), array('1', '22', '33A', '44bb'));
} }
public function testMinSymbol() { public function testMinSymbol() {
$this->cfg->passwordMinSymbol = 3; $this->cfg->passwordMinSymbol = 3;
$this->checkPwd(array('---', '++++'), array('1.', '2.2.', '3+3+A', '44bb')); $this->checkPwd(array('---', '++++'), array('1.', '2.2.', '3+3+A', '44bb'));
} }
public function testMinClasses() { public function testMinClasses() {
$this->cfg->passwordMinClasses = 3; $this->cfg->passwordMinClasses = 3;
$this->checkPwd(array('aB.', 'aB.1', 'aa.B99'), array('1', '2.', '3+-', '44bb')); $this->checkPwd(array('aB.', 'aB.1', 'aa.B99'), array('1', '2.', '3+-', '44bb'));
} }
public function testRulesCount() { public function testRulesCount() {
$this->cfg->passwordMinUpper = 3; $this->cfg->passwordMinUpper = 3;
$this->cfg->passwordMinLower = 3; $this->cfg->passwordMinLower = 3;
@ -85,12 +85,12 @@ class SecurityTest extends PHPUnit_Framework_TestCase {
$this->cfg->checkedRulesCount = 3; $this->cfg->checkedRulesCount = 3;
$this->checkPwd(array('ABC---abc', 'ABC123.-.-', 'ABCabc-'), array('1', '2.', '3+-', '44bb', 'ABC--22')); $this->checkPwd(array('ABC---abc', 'ABC123.-.-', 'ABCabc-'), array('1', '2.', '3+-', '44bb', 'ABC--22'));
} }
public function testUser() { public function testUser() {
$this->cfg->passwordMustNotContainUser = 'true'; $this->cfg->passwordMustNotContainUser = 'true';
$this->checkPwd(array('u', 'us', 'use', 'use1r'), array('user', '2user', 'user3'), 'user'); $this->checkPwd(array('u', 'us', 'use', 'use1r'), array('user', '2user', 'user3'), 'user');
} }
public function testUserAttributes() { public function testUserAttributes() {
$this->cfg->passwordMustNotContain3Chars = 'true'; $this->cfg->passwordMustNotContain3Chars = 'true';
$this->checkPwd(array('u', 'us', 'us1e', 'us1er'), array('use', 'user', '2user', 'user3'), 'user'); $this->checkPwd(array('u', 'us', 'us1e', 'us1er'), array('use', 'user', '2user', 'user3'), 'user');
@ -100,7 +100,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase {
'user', 'user',
array('first', 'last')); array('first', 'last'));
} }
/** /**
* Resets the password rules to do no checks at all. * Resets the password rules to do no checks at all.
*/ */
@ -115,10 +115,10 @@ class SecurityTest extends PHPUnit_Framework_TestCase {
$this->cfg->passwordMustNotContainUser = 'false'; $this->cfg->passwordMustNotContainUser = 'false';
$this->cfg->passwordMustNotContain3Chars = 'false'; $this->cfg->passwordMustNotContain3Chars = 'false';
} }
/** /**
* Checks if the given passwords are correctly accepted/rejected. * Checks if the given passwords are correctly accepted/rejected.
* *
* @param array $pwdsToAccept passwords that must be accepted * @param array $pwdsToAccept passwords that must be accepted
* @param array $pwdsToReject passwords that must be rejected * @param array $pwdsToReject passwords that must be rejected
* @param String $userName user name * @param String $userName user name

View File

@ -1,3 +1,4 @@
<?php
/* /*
$Id$ $Id$
@ -19,7 +20,6 @@ $Id$
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
<?php
include_once (dirname(__FILE__) . '/../../lib/config.inc'); include_once (dirname(__FILE__) . '/../../lib/config.inc');