From 8eb3b391ad9999a3c01c6a90939e443729edb5f6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 19 Dec 2006 00:33:53 +0000 Subject: passwd: add option to check passwords for weakness --- loginutils/Config.in | 7 +++++++ loginutils/passwd.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/loginutils/Config.in b/loginutils/Config.in index 3628c49af..56778b241 100644 --- a/loginutils/Config.in +++ b/loginutils/Config.in @@ -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 diff --git a/loginutils/passwd.c b/loginutils/passwd.c index bcb7f2b26..c825c978f 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -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:"); -- cgit v1.2.3