passwd: add option to check passwords for weakness
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 19 Dec 2006 00:33:53 +0000 (00:33 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 19 Dec 2006 00:33:53 +0000 (00:33 -0000)
loginutils/Config.in
loginutils/passwd.c

index 3628c49afaf7b6709886a49b9a5abae896050296..56778b241878932d9e0b37774cb7f08360113a64 100644 (file)
@@ -142,6 +142,13 @@ config PASSWD
          Note that Busybox binary must be setuid root for this applet to
          work properly.
 
+config FEATURE_PASSWD_WEAK_CHECK
+       bool "Check new passwords for weakness"
+       default y
+       depends on PASSWD
+       help
+         With this option passwd will refuse new passwords which are "weak".
+
 config SU
        bool "su"
        default n
index bcb7f2b26114b87940076b957f9278abd47f2ad7..c825c978fdc388baa1daa49221bacec3ba260ae5 100644 (file)
@@ -77,7 +77,8 @@ static char* new_password(const struct passwd *pw, uid_t myuid, int algo)
        if (!newp)
                goto err_ret;
        newp = xstrdup(newp); /* we are going to bb_askpass() again, so save it */
-       if (obscure(orig, newp, pw) && myuid)
+       if (ENABLE_FEATURE_PASSWD_WEAK_CHECK
+        && obscure(orig, newp, pw) && myuid)
                goto err_ret; /* non-root is not allowed to have weak passwd */
 
        cp = bb_askpass(0, "Retype password:");