fix the evaluation of password quality; thanks to the clang static analyzer for point...
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 21:48:49 +0000 (21:48 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 21:48:49 +0000 (21:48 +0000)
webcit/auth.c

index d37382f224d8a22c144114e7a5a19a6dff3e35dd..fde5a501b1d6e8d06f4a79dfdbde5511b6133c6c 100644 (file)
@@ -681,7 +681,7 @@ void validate(void)
                                int haveChar = 0;
                                int haveNum = 0;
                                int haveOther = 0;
-                               int count = 0;
+                               int haveLong = 0;
                                pch = buf;
                                while (!IsEmptyStr(pch))
                                {
@@ -693,10 +693,13 @@ void validate(void)
                                                haveOther = 1;
                                        pch ++;
                                }
-                               count = pch - buf;
-                               if (count > 7)
-                                       count = 0;
-                               switch (count){
+                               if (pch - buf > 7)
+                                       haveLong = 1;
+                               switch (haveLong + 
+                                       haveChar + 
+                                       haveNum + 
+                                       haveOther)
+                               {
                                case 0:
                                        pch = _("very weak");
                                        break;