From cd1bb9dd287376431fde77ce22be40b6f9f89897 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 15 Aug 2024 14:21:41 +0200 Subject: Let pwquality check minimum length This is a policy decision, so let's not enforce something on our own if there is a system policy to rely on. --- unix/vncpasswd/vncpasswd.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/unix/vncpasswd/vncpasswd.cxx b/unix/vncpasswd/vncpasswd.cxx index b17e73dd..6666955f 100644 --- a/unix/vncpasswd/vncpasswd.cxx +++ b/unix/vncpasswd/vncpasswd.cxx @@ -139,14 +139,12 @@ static std::vector readpassword() { perror("getpassword error"); exit(1); } + std::string first = passwd; - if (first.size() < 6) { - if (first.empty()) { - fprintf(stderr,"Password not changed\n"); - exit(1); - } - fprintf(stderr,"Password must be at least 6 characters - try again\n"); - continue; + + if (first.empty()) { + fprintf(stderr,"Password not changed\n"); + exit(1); } if (first.size() > 8) { @@ -161,6 +159,11 @@ static std::vector readpassword() { printf("Password quality check failed, please set it correctly.\n"); continue; } +#else + if (first.size() < 6) { + fprintf(stderr,"Password must be at least 6 characters - try again\n"); + continue; + } #endif passwd = getpassword("Verify:"); -- cgit v1.2.3