diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2018-11-04 11:25:13 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2018-11-04 11:25:13 +0000 |
commit | 9aadb640576810c5a54b4f53b8b7a07db9f515f9 (patch) | |
tree | 8f471ce6ec61ffb365b142b102a6d4f0ddfb61bd | |
parent | 0311c126fc6c60dd6f6a131c2a8c862cbfe3f9ca (diff) | |
download | netsurf-test-9aadb640576810c5a54b4f53b8b7a07db9f515f9.tar.gz netsurf-test-9aadb640576810c5a54b4f53b8b7a07db9f515f9.tar.bz2 |
More debug
-rwxr-xr-x | cgi-bin/auth.cgi | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cgi-bin/auth.cgi b/cgi-bin/auth.cgi index 0f68b18..de08fe2 100755 --- a/cgi-bin/auth.cgi +++ b/cgi-bin/auth.cgi @@ -17,9 +17,11 @@ query = os.getenv("QUERY_STRING") or "user=foo&pass=bar" query = cgi.parse_qs(query) username = query.get("user", "foo") password = query.get("pass", query.get("password", "bar")) +gotuser = None +gotpass = None def badauth(reason="NOAUTH"): - print('result=BAD, reason={}'.format(reason)) + print('result=BAD, username={}, password={}, reason={}'.format(gotuser, gotpass, reason)) raise SystemExit if not auth: @@ -32,9 +34,11 @@ else: if ":" not in dec: badauth("NOCOLON") bits = dec.rsplit(':', maxsplit=1) - if bits[0] != username: + gotuser = bits[0] + gotpass = bits[1] + if gotuser != username: badauth("BADUSER") - if bits[1] != password: + if gotpass != password: badauth("BADPASS") |