mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Change the "namevals" key in the return value of
http.read_auth_challenge to "params" to match RFC 2617.
This commit is contained in:
@@ -1415,16 +1415,16 @@ function parse_date(s)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- See RFC 2617, section 1.2. This function returns a table with keys "scheme"
|
-- See RFC 2617, section 1.2. This function returns a table with keys "scheme"
|
||||||
-- and "namevals".
|
-- and "params".
|
||||||
local read_auth_challenge = function(s, pos)
|
local read_auth_challenge = function(s, pos)
|
||||||
local _, pos, scheme, namevals
|
local _, pos, scheme, params
|
||||||
|
|
||||||
pos, scheme = read_token(s, pos)
|
pos, scheme = read_token(s, pos)
|
||||||
if not scheme then
|
if not scheme then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
namevals = {}
|
params = {}
|
||||||
pos = skip_space(s, pos)
|
pos = skip_space(s, pos)
|
||||||
while pos < string.len(s) do
|
while pos < string.len(s) do
|
||||||
local name, val
|
local name, val
|
||||||
@@ -1436,10 +1436,10 @@ local read_auth_challenge = function(s, pos)
|
|||||||
end
|
end
|
||||||
pos = pos + 1
|
pos = pos + 1
|
||||||
pos, val = read_token_or_quoted_string(s, pos)
|
pos, val = read_token_or_quoted_string(s, pos)
|
||||||
if namevals[name] then
|
if params[name] then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
namevals[name] = val
|
params[name] = val
|
||||||
pos = skip_space(s, pos)
|
pos = skip_space(s, pos)
|
||||||
if string.sub(s, pos, pos) == "," then
|
if string.sub(s, pos, pos) == "," then
|
||||||
pos = skip_space(s, pos + 1)
|
pos = skip_space(s, pos + 1)
|
||||||
@@ -1449,14 +1449,14 @@ local read_auth_challenge = function(s, pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return pos, { scheme = scheme, namevals = namevals }
|
return pos, { scheme = scheme, param = param }
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Parses the WWW-Authenticate header as described in RFC 2616, section 14.47
|
-- Parses the WWW-Authenticate header as described in RFC 2616, section 14.47
|
||||||
-- and RFC 2617, section 1.2. The return value is an array of challenges. Each
|
-- and RFC 2617, section 1.2. The return value is an array of challenges. Each
|
||||||
-- challenge is a table with the keys <code>scheme</code> and
|
-- challenge is a table with the keys <code>scheme</code> and
|
||||||
-- <code>namevals</code>.
|
-- <code>params</code>.
|
||||||
-- @param s The header value text.
|
-- @param s The header value text.
|
||||||
-- @return An array of challenges, or <code>nil</code> on error.
|
-- @return An array of challenges, or <code>nil</code> on error.
|
||||||
parse_www_authenticate = function(s)
|
parse_www_authenticate = function(s)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ action = function(host, port)
|
|||||||
basic_challenge = challenge
|
basic_challenge = challenge
|
||||||
end
|
end
|
||||||
local line = challenge.scheme
|
local line = challenge.scheme
|
||||||
for name, value in pairs(challenge.namevals) do
|
for name, value in pairs(challenge.params) do
|
||||||
line = line .. string.format(" %s=%s", name, value)
|
line = line .. string.format(" %s=%s", name, value)
|
||||||
end
|
end
|
||||||
result[#result + 1] = line
|
result[#result + 1] = line
|
||||||
|
|||||||
Reference in New Issue
Block a user