summaryrefslogtreecommitdiffstats
path: root/lib/setup.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2012-09-29 15:41:13 +0200
committerLukas Reschke <lukas@statuscode.ch>2012-09-29 15:41:13 +0200
commit992c2c9d4bc20db1dc8170dcc60dc4438dc55eb0 (patch)
tree1b9cfb83b912d55c4766f7561dedbc63233793ee /lib/setup.php
parent36f1c9b0835bd7118dc7d8aba4b4c56c6d922b09 (diff)
downloadnextcloud-server-992c2c9d4bc20db1dc8170dcc60dc4438dc55eb0.tar.gz
nextcloud-server-992c2c9d4bc20db1dc8170dcc60dc4438dc55eb0.zip
mt_rand() is not secure from a cryptographic point of view, let's use openssl_random_pseudo_bytes() here
Diffstat (limited to 'lib/setup.php')
-rw-r--r--lib/setup.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/setup.php b/lib/setup.php
index c21c8be3957..6d8430c1036 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -79,7 +79,8 @@ class OC_Setup {
}
//generate a random salt that is used to salt the local user passwords
- $salt=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000);
+ $random_bytes = openssl_random_pseudo_bytes(30, $cstrong);
+ $salt = bin2hex($random_bytes);
OC_Config::setValue('passwordsalt', $salt);
//write the config file