summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-09-23 12:16:58 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-09-23 12:16:58 +0200
commit42fe0b9e0865cfa81edae922e77144e789e52447 (patch)
treed4577dba6dba106e1590c9c2b20166aa1a1ac957
parent5d977f97b0e0564e3922665530ea468ec069768d (diff)
parent1565d82b81ee1f6960033a057260c884036e1159 (diff)
downloadnextcloud-server-42fe0b9e0865cfa81edae922e77144e789e52447.tar.gz
nextcloud-server-42fe0b9e0865cfa81edae922e77144e789e52447.zip
Merge pull request #11241 from owncloud/use-lower-case
Use only lower-case letters
-rwxr-xr-xlib/private/util.php2
-rw-r--r--tests/lib/util.php5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index f84bbede0ac..18857139791 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -877,7 +877,7 @@ class OC_Util {
$id = OC_Config::getValue('instanceid', null);
if (is_null($id)) {
// We need to guarantee at least one letter in instanceid so it can be used as the session_name
- $id = 'oc' . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10);
+ $id = 'oc' . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
OC_Config::$object->setValue('instanceid', $id);
}
return $id;
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 8964f9f2666..999c62486a7 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -116,7 +116,10 @@ class Test_Util extends PHPUnit_Framework_TestCase {
function testGetInstanceIdGeneratesValidId() {
OC_Config::deleteKey('instanceid');
- $this->assertStringStartsWith('oc', OC_Util::getInstanceId());
+ $instanceId = OC_Util::getInstanceId();
+ $this->assertStringStartsWith('oc', $instanceId);
+ $matchesRegex = preg_match('/^[a-z0-9]+$/', $instanceId);
+ $this->assertSame(1, $matchesRegex);
}
/**