[PATCH] Use libpwquality to check root password strength (#755883)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 anaconda.spec.in                  |    1 +
 pyanaconda/iw/account_gui.py      |    9 +++++----
 pyanaconda/textw/userauth_text.py |    9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/anaconda.spec.in b/anaconda.spec.in
index d1ac562..c480a95 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -126,6 +126,7 @@ Requires: util-linux >= 2.15.1
 Requires: system-config-keyboard >= %{sckeyboardver}
 Requires: dbus-python
 Requires: cracklib-python
+Requires: python-pwquality
 Requires: python-bugzilla
 Requires: python-nss
 Requires: tigervnc-server-minimal
diff --git a/pyanaconda/iw/account_gui.py b/pyanaconda/iw/account_gui.py
index 67859e1..be8c4b5 100644
--- a/pyanaconda/iw/account_gui.py
+++ b/pyanaconda/iw/account_gui.py
@@ -25,7 +25,7 @@ from pyanaconda import gui
 from iw_gui import *
 from pyanaconda.flags import flags
 from pyanaconda.constants import *
-import cracklib
+import pwquality
 from pyanaconda import _isys
 
 import gettext
@@ -121,9 +121,10 @@ class AccountWindow (InstallWindow):
             self.passwordError()
 
         try:
-            cracklib.FascistCheck(pw)
-        except ValueError as e:
-            msg = gettext.ldgettext("cracklib", e)
+            settings = pwquality.PWQSettings()
+            settings.read_config()
+            settings.check(pw, None, "root")
+        except pwquality.PWQError as (e, msg):
             ret = self.intf.messageWindow(_("Weak Password"),
                                           _("You have provided a weak password: %s") % msg,
                                           type="custom", custom_icon="error",
diff --git a/pyanaconda/textw/userauth_text.py b/pyanaconda/textw/userauth_text.py
index b488962..8008a63 100644
--- a/pyanaconda/textw/userauth_text.py
+++ b/pyanaconda/textw/userauth_text.py
@@ -19,7 +19,7 @@
 
 from snack import *
 from constants_text import *
-import cracklib
+import pwquality
 
 from pyanaconda.constants import *
 import gettext
@@ -77,9 +77,10 @@ class RootPasswordWindow:
                     buttons = [ TEXT_OK_BUTTON ], width = 50)
             else:
                 try:
-                    cracklib.FascistCheck(entry1.value())
-                except ValueError as e:
-                    msg = gettext.ldgettext("cracklib", e)
+                    settings = pwquality.PWQSettings()
+                    settings.read_config()
+                    settings.check(entry1.value(), None, "root")
+                except pwquality.PWQError as (e, msg):
                     ret = anaconda.intf.messageWindow(_("Weak Password"),
                              _("You have provided a weak password: %s\n\n"
                                "Would you like to continue with this password?"
-- 
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux