summaryrefslogtreecommitdiffstats
path: root/main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch')
-rw-r--r--main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch b/main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch
new file mode 100644
index 000000000..a228e97c5
--- /dev/null
+++ b/main/acf-core/0002-Fixed-mksalt-to-use-correct-characters.patch
@@ -0,0 +1,37 @@
+From f41fd7182d71427d7a0adf54e55df3a3c97a667e Mon Sep 17 00:00:00 2001
+From: Ted Trask <ttrask01@yahoo.com>
+Date: Thu, 27 Oct 2011 18:51:08 +0000
+Subject: [PATCH 2/2] Fixed mksalt to use correct characters
+
+---
+ lib/authenticator.lua | 13 ++++++++++---
+ 1 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/lib/authenticator.lua b/lib/authenticator.lua
+index f3af4e3..43814c1 100644
+--- a/lib/authenticator.lua
++++ b/lib/authenticator.lua
+@@ -96,10 +96,17 @@ local verify_password = function(plaintext, pwhash)
+ return (pwhash == md5.sumhexa(plaintext))
+ end
+
+--- generate a salt string
++local b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"
++
+ local mksalt = function()
+- -- use sha-512 algorithm (no 6)
+- return "$6$"..session.random_hash(96).."$"
++ local file = io.open("/dev/urandom")
++ local str = ""
++ if file == nil then return nil end
++ for i = 1,16 do
++ local offset = (string.byte(file:read(1)) % 64) + 1
++ str = str .. string.sub (b64, offset, offset)
++ end
++ return "$6$"..str.."$"
+ end
+
+ --- public methods
+--
+1.7.8.2
+