]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use base62 and remove configuration options for link length
authorkondou <kondou@ts.unde.re>
Thu, 4 Sep 2014 14:20:20 +0000 (16:20 +0200)
committerkondou <kondou@ts.unde.re>
Thu, 4 Sep 2014 14:20:20 +0000 (16:20 +0200)
config/config.sample.php
lib/private/share/share.php

index b895f236c4a8c85e7914652d7c3cde439ac7f2ea..71105a8b10d85b4259396394f2bed6bbc50cae21 100755 (executable)
@@ -201,20 +201,6 @@ $CONFIG = array(
 /* Whether ownCloud should log the last successfull cron exec */
 "cron_log" => true,
 
-/*
- * Length of sharing tokens and the resulting links.
- * This value defines how many possible sharing links there are, choosing a low value like 3 will make it easy to guess
- * sharing links and will also limit the maximum number of shares. Behaviour after all tokens are used is undefined and
- * may result in breakage. The minimum value is 3, the maximum value is 64. Default is 13. Some example values:
- * Length of 3 (This value is not recommended). Maximum of 46656 tokens. Links may look like this: example.com/s/1ek
- * Length of 8. Maximum of 2.8*10^12 tokens. Links may look like this: example.com/s/1z1a41z3
- * Length of 13 (Default). Maximum of 1.7*10^20 tokens. Links may look like this: example.com/s/3w5e11264sgsf
- * Length of 25 (Near old default). Maximum of 8*10^38 tokens. Links may look like this: example.com/s/f5lxx1zz5pnorynqglhzmsp33
- * Length of 40. Maximum of 1.8*10^62 tokens. Links may look like this: example.com/s/8rnpuh6h4mnepp1hrnlicj80yxhyw8lq49gtid4n
- * Length of 64. Maximum of 4*10^99 tokens. Links may look like this: example.com/s/i5yli3xmet7crsf2frc1o12ygsb824im9dmyikg45fvo3vym9tswzr0r4wmtgx7i
- */
-"sharing_token_length" => 13,
-
 /*
  * Configure the size in bytes log rotation should happen, 0 or false disables the rotation.
  * This rotates the current owncloud logfile to a new name, this way the total log usage
index 658eaeb3a416dffaf1b6bfb62862fcd13c4e95d4..fe62f4f005e7e337d33ce69a204550a996e22ced 100644 (file)
@@ -640,14 +640,9 @@ class Share extends \OC\Share\Constants {
                                if (isset($oldToken)) {
                                        $token = $oldToken;
                                } else {
-                                       $tokenLength = \OC_Config::getValue("sharing_token_length", 13);
-
-                                       // Enforce a limit on token length
-                                       if ($tokenLength < 3 || $tokenLength > 64) {
-                                               $tokenLength = 13;
-                                       }
                                        $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($tokenLength,
-                                               \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS
+                                               \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER.
+                                               \OCP\Security\ISecureRandom::CHAR_DIGITS
                                        );
                                }
                                $result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions,