Comparison

mod_auth_ha1/mod_auth_ha1.lua @ 1473:31c4d92a81e5

mod_auth_ha1: Skip commented lines
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Jul 2014 14:36:12 +0100
parent 1472:d44926f39f00
comparison
equal deleted inserted replaced
1472:d44926f39f00 1473:31c4d92a81e5
27 local line_number, imported_count, not_authorized_count = 0, 0, 0; 27 local line_number, imported_count, not_authorized_count = 0, 0, 0;
28 for line in f:lines() do 28 for line in f:lines() do
29 line_number = line_number + 1; 29 line_number = line_number + 1;
30 local username, hash, realm, state = line:match("^([^:]+):(%x+):([^:]+):(.+)$"); 30 local username, hash, realm, state = line:match("^([^:]+):(%x+):([^:]+):(.+)$");
31 if not username then 31 if not username then
32 module:log("error", "Unable to parse line %d of auth file, skipping", line_number); 32 if line:sub(1,1) ~= "#" then
33 module:log("error", "Unable to parse line %d of auth file, skipping", line_number);
34 end
33 else 35 else
34 username, realm = nodeprep(username), nameprep(realm); 36 username, realm = nodeprep(username), nameprep(realm);
35 if not username then 37 if not username then
36 module:log("error", "Invalid username on line %d of auth file, skipping", line_number); 38 module:log("error", "Invalid username on line %d of auth file, skipping", line_number);
37 elseif not realm then 39 elseif not realm then