From 7e8500eea1e53b1de0e0f70400664afa442cd08d Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Thu, 2 Oct 2014 14:55:24 +0200 Subject: PHPDocs and some improvements --- lib/plugins/authplain/_test/escaping.test.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/plugins/authplain/_test') diff --git a/lib/plugins/authplain/_test/escaping.test.php b/lib/plugins/authplain/_test/escaping.test.php index cd5294157..5cf631508 100644 --- a/lib/plugins/authplain/_test/escaping.test.php +++ b/lib/plugins/authplain/_test/escaping.test.php @@ -12,10 +12,11 @@ * @group plugins */ class helper_plugin_authplain_escaping_test extends DokuWikiTest { - + protected $pluginsEnabled = array('authplain'); + /** @var auth_plugin_authplain */ protected $auth; - + protected function reloadUsers() { /* auth caches data loaded from file, but recreated object forces reload */ $this->auth = new auth_plugin_authplain(); -- cgit v1.2.3 From 6c8c1f4632a82459236200e9264c40ecebd4b162 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 3 Oct 2014 17:41:14 +0100 Subject: Fix for issues 877 & 885 related to a bug in PCRE 6.6 --- lib/plugins/authplain/_test/escaping.test.php | 43 +++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'lib/plugins/authplain/_test') diff --git a/lib/plugins/authplain/_test/escaping.test.php b/lib/plugins/authplain/_test/escaping.test.php index cd5294157..5a5f67c82 100644 --- a/lib/plugins/authplain/_test/escaping.test.php +++ b/lib/plugins/authplain/_test/escaping.test.php @@ -13,12 +13,12 @@ */ class helper_plugin_authplain_escaping_test extends DokuWikiTest { - protected $pluginsEnabled = array('authplain'); + protected $pluginsEnabled = array('authplainharness'); protected $auth; protected function reloadUsers() { /* auth caches data loaded from file, but recreated object forces reload */ - $this->auth = new auth_plugin_authplain(); + $this->auth = new auth_plugin_authplainharness(); } function setUp() { @@ -76,7 +76,44 @@ class helper_plugin_authplain_escaping_test extends DokuWikiTest { $this->assertEquals($saved['name'], $user['name']); $this->assertTrue($this->auth->checkPass("testuser", $user['pass'])); } + + // really only required for developers to ensure this plugin will + // work with systems running on PCRE 6.6 and lower. + public function testLineSplit(){ + $this->auth->setPregsplit_safe(false); + + $names = array( + 'plain', + 'ut-fठ8', + 'colon:', + 'backslash\\', + 'alltogether\\ठ:' + ); + $userpass = 'user:password_hash:'; + $other_user_data = ':email@address:group1,group2'; + + foreach ($names as $testname) { + $escaped = str_replace(array('\\',':'),array('\\\\','\\:'),$testname); // escape : & \ + $test_line = $userpass.$escaped.$other_user_data; + $result = $this->auth->splitUserData($test_line); + + $this->assertEquals($testname, $result[2]); + } + } } -?> \ No newline at end of file +class auth_plugin_authplainharness extends auth_plugin_authplain { + + public function setPregsplit_safe($bool) { + $this->_pregsplit_safe = $bool; + } + + public function getPregsplit_safe(){ + return $this->_pregsplit_safe; + } + + public function splitUserData($line){ + return $this->_splitUserData($line); + } +} \ No newline at end of file -- cgit v1.2.3 From 9d846ff4e2a1d18faa3ce6df15f89425d194dd06 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 4 Oct 2014 11:59:42 +0100 Subject: escaping backslash should be included in split items --- lib/plugins/authplain/_test/escaping.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/plugins/authplain/_test') diff --git a/lib/plugins/authplain/_test/escaping.test.php b/lib/plugins/authplain/_test/escaping.test.php index 5a5f67c82..cbfbbc587 100644 --- a/lib/plugins/authplain/_test/escaping.test.php +++ b/lib/plugins/authplain/_test/escaping.test.php @@ -97,7 +97,7 @@ class helper_plugin_authplain_escaping_test extends DokuWikiTest { $test_line = $userpass.$escaped.$other_user_data; $result = $this->auth->splitUserData($test_line); - $this->assertEquals($testname, $result[2]); + $this->assertEquals($escaped, $result[2]); } } -- cgit v1.2.3