any value in configuring minimum password length?

Robert P. J. Day rpjday at mindspring.com
Sun Jul 2 16:06:06 UTC 2006


On Sun, 2 Jul 2006, Bernhard Fischer wrote:

> On Sun, Jul 02, 2006 at 11:41:51AM -0400, Robert P. J. Day wrote:
> >
> >libbb/obscure.c
> >---------------
> >
> >#define MINLEN 6
> >
> >  any value in taking the extra step and allowing this to be changed
> >during configuration?
>
> put it in libbb/Config.in if you feel like
>
> config CONFIG_PASSWORD_MINLEN
> 	int "description"
> 	default 6
> 	range 5 255 /* or the like */
> 	help
> 	  help text here

i'm assuming something like the following would be sufficient, yes?

Index: libbb/obscure.c
===================================================================
--- libbb/obscure.c	(revision 15578)
+++ libbb/obscure.c	(working copy)
@@ -46,11 +46,6 @@

 #include "libbb.h"

-
-/* passwords should consist of 6 (to 8 characters) */
-#define MINLEN 6
-
-
 static int string_checker_helper(const char *p1, const char *p2) __attribute__ ((__pure__));

 static int string_checker_helper(const char *p1, const char *p2)
@@ -101,12 +96,12 @@
 	int length;
 	int mixed = 0;
 	/* Add 1 for each type of characters to the minlen of password */
-	int size = MINLEN + 8;
+	int size = CONFIG_PASSWORD_MINLEN + 8;
 	const char *p;
 	char hostname[255];

 	/* size */
-	if (!new_p || (length = strlen(new_p)) < MINLEN)
+	if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN)
 		return("too short");

 	/* no username as-is, as sub-string, reversed, capitalized, doubled */
Index: libbb/Config.in
===================================================================
--- libbb/Config.in	(revision 15578)
+++ libbb/Config.in	(working copy)
@@ -5,6 +5,13 @@

 menu "Busybox Library Tuning"

+config CONFIG_PASSWORD_MINLEN
+	int "Minimum password length"
+	default 6
+	range 5 32
+	help
+	  Minimum allowable password length.
+
 config CONFIG_MD5_SIZE_VS_SPEED
 	int " MD5: Trade Bytes for Speed"
 	default 2



rday



More information about the busybox mailing list