diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Spend a missing account's login on a real hash
The fixed SHA-512 stand-in matched only the documented setup, so a site hashing with yescrypt, other rounds or bcrypt answered for missing and real names in different times, and on OpenBSD it failed at once.
Diffstat (limited to '')
-rw-r--r--tests/extensions/harness.lua17
1 file changed, 17 insertions, 0 deletions
diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua
index fc83a73..3df4719 100644
--- a/tests/extensions/harness.lua
+++ b/tests/extensions/harness.lua
@@ -78,6 +78,23 @@ function harness.load(script)
dofile(script)
end
+-- Load a script with some of its own text replaced first, for checks that
+-- need the commented-out examples of its configuration switched on. Each
+-- replacement has to match exactly once, so a reworded example fails here
+-- rather than leaving the check to test the unedited configuration.
+function harness.load_with(script, replacements)
+ local file = assert(io.open(script, "rb"))
+ local source = file:read("*a")
+ file:close()
+ for _, pair in ipairs(replacements) do
+ local start = source:find(pair[1], 1, true)
+ assert(start and not source:find(pair[1], start + 1, true),
+ "expected exactly one " .. pair[1])
+ source = source:sub(1, start - 1) .. pair[2] .. source:sub(start + #pair[1])
+ end
+ assert((loadstring or load)(source, "@" .. script))()
+end
+
local unpack_args = unpack or table.unpack
-- One whole filter round trip, an open with the given arguments, a write per