diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2014-03-20 16:31:12 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2014-03-20 16:31:12 +0100 |
commit | 2c561c9c5072ce82e06bd5ab2c4ee81bc5d09d59 (patch) | |
tree | a34586bf389cc8011490031bba497129361655a3 /lib | |
parent | 316a22b46315a389e38cd9f1e320f3e1f0541d68 (diff) | |
parent | d95fde39248e8c4083c14788fe3a327a60611b47 (diff) | |
download | nextcloud-server-2c561c9c5072ce82e06bd5ab2c4ee81bc5d09d59.tar.gz nextcloud-server-2c561c9c5072ce82e06bd5ab2c4ee81bc5d09d59.zip |
Merge pull request #7794 from owncloud/extstorage-obfuscatepasswords
Obfuscate passwords in ext storage config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/filesystem.php | 70 | ||||
-rw-r--r-- | lib/public/util.php | 9 |
2 files changed, 9 insertions, 70 deletions
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 6478854eae8..c31e0c38180 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -320,82 +320,12 @@ class Filesystem { else { self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user); } - $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data"); - $mount_file = \OC_Config::getValue("mount_file", $datadir . "/mount.json"); - - //move config file to it's new position - if (is_file(\OC::$SERVERROOT . '/config/mount.json')) { - rename(\OC::$SERVERROOT . '/config/mount.json', $mount_file); - } - // Load system mount points - if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file($mount_file)) { - if (is_file($mount_file)) { - $mountConfig = json_decode(file_get_contents($mount_file), true); - } elseif (is_file(\OC::$SERVERROOT . '/config/mount.php')) { - $mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php')); - } - if (isset($mountConfig['global'])) { - foreach ($mountConfig['global'] as $mountPoint => $options) { - self::mount($options['class'], $options['options'], $mountPoint); - } - } - if (isset($mountConfig['group'])) { - foreach ($mountConfig['group'] as $group => $mounts) { - if (\OC_Group::inGroup($user, $group)) { - foreach ($mounts as $mountPoint => $options) { - $mountPoint = self::setUserVars($user, $mountPoint); - foreach ($options as &$option) { - $option = self::setUserVars($user, $option); - } - self::mount($options['class'], $options['options'], $mountPoint); - } - } - } - } - if (isset($mountConfig['user'])) { - foreach ($mountConfig['user'] as $mountUser => $mounts) { - if ($mountUser === 'all' or strtolower($mountUser) === strtolower($user)) { - foreach ($mounts as $mountPoint => $options) { - $mountPoint = self::setUserVars($user, $mountPoint); - foreach ($options as &$option) { - $option = self::setUserVars($user, $option); - } - self::mount($options['class'], $options['options'], $mountPoint); - } - } - } - } - } - // Load personal mount points - if (is_file($root . '/mount.php') or is_file($root . '/mount.json')) { - if (is_file($root . '/mount.json')) { - $mountConfig = json_decode(file_get_contents($root . '/mount.json'), true); - } elseif (is_file($root . '/mount.php')) { - $mountConfig = $parser->parsePHP(file_get_contents($root . '/mount.php')); - } - if (isset($mountConfig['user'][$user])) { - foreach ($mountConfig['user'][$user] as $mountPoint => $options) { - self::mount($options['class'], $options['options'], $mountPoint); - } - } - } // Chance to mount for other storages \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root)); } /** - * fill in the correct values for $user - * - * @param string $user - * @param string $input - * @return string - */ - private static function setUserVars($user, $input) { - return str_replace('$user', $user, $input); - } - - /** * get the default filesystem view * * @return View diff --git a/lib/public/util.php b/lib/public/util.php index a159bf1423c..5cc7f0f4676 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -492,4 +492,13 @@ class Util { public static function isValidFileName($file) { return \OC_Util::isValidFileName($file); } + + /** + * @brief Generates a cryptographic secure pseudo-random string + * @param Int $length of the random string + * @return String + */ + public static function generateRandomBytes($length = 30) { + return \OC_Util::generateRandomBytes($length); + } } |