Commit bfbd12f7 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Warn on invalid lines in HTTP user files



Without this change, invalid lines or values would be silently ignored.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 3e0b97b5
......@@ -310,6 +310,8 @@ def ParsePasswordFile(contents):
parts = line.split(None, 2)
if len(parts) < 2:
# Invalid line
# TODO: Return line number from FilterEmptyLinesAndComments
logging.warning("Ignoring non-comment line with less than two fields")
continue
name = parts[0]
......@@ -320,6 +322,8 @@ def ParsePasswordFile(contents):
if len(parts) >= 3:
for part in parts[2].split(","):
options.append(part.strip())
else:
logging.warning("Ignoring values for user '%s': %s", name, parts[3:])
users[name] = PasswordFileUser(name, password, options)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment