From 977f6207719f8c0470eca1404624784d723bdc4a Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 23 Jan 2003 22:55:14 +0000 Subject: only allow ascii passwords. anything else is nonsensical and impossible to handle sanely due to lack of a defined encoding for the passwd file (#81534) --- textw/userauth_text.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'textw') diff --git a/textw/userauth_text.py b/textw/userauth_text.py index ced88eb63..466f336f6 100644 --- a/textw/userauth_text.py +++ b/textw/userauth_text.py @@ -17,8 +17,15 @@ from rhpl.translate import _ import iutil from flags import flags +def has_bad_chars(pw): + allowed = string.digits + string.ascii_letters + string.punctuation + for letter in pw: + if letter not in allowed: + return 1 + return 0 + class RootPasswordWindow: - def __call__ (self, screen, rootPw): + def __call__ (self, screen, intf, rootPw): toplevel = GridFormHelp (screen, _("Root Password"), "rootpw", 1, 3) toplevel.add (TextboxReflowed(37, _("Pick a root password. You must " @@ -60,6 +67,11 @@ class RootPasswordWindow: _("The passwords you entered were different. Please " "try again."), buttons = [ TEXT_OK_BUTTON ], width = 50) + elif has_bad_chars(entry1.value()): + ButtonChoiceWindow(screen, _("Error with Password"), + _("Requested password contains non-ascii characters " + "which are not allowed for use in password."), + buttons = [ TEXT_OK_BUTTON ], width = 50) else: break -- cgit