Merge pull request #1379 from 12pm/pr_auth_username_quote_semicolon

Fix output for usernames with double quotes and semicolons
This commit is contained in:
Dennis Felsing 2018-11-15 19:53:15 +01:00 committed by GitHub
commit 5348533858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,8 @@ def auth_add_p_line(username, level, pwhash, salt):
print("Warning: level ({}) contains weird symbols, config line is possibly malformed.".format(level), file=sys.stderr)
if repr(username) != "'{}'".format(username):
print("Warning: username ({}) contains weird symbols, config line is possibly malformed.".format(username), file=sys.stderr)
if ' ' in username:
username = username.replace('"', '\\"')
if ' ' in username or ';' in username:
username = '"{}"'.format(username)
return "auth_add_p {} {} {} {}".format(username, level, pwhash, salt)