From 26662db315dd5775f7beaad6ab04e9ca4c97f372 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 22:11:55 -1000 Subject: 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. --- tests/extensions/harness.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/extensions/harness.lua') 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 -- cgit