summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
author"Robert P. J. Day"2006-07-02 18:35:39 +0000
committer"Robert P. J. Day"2006-07-02 18:35:39 +0000
commit087b9d640ed66f37249c09885fa86b27a78554c7 (patch)
tree2186495a0096f2adeb2691f749efe83b9b6d881e /libbb
parente02706fe45c46939319be7a9f4b2018393fb173b (diff)
downloadbusybox-087b9d640ed66f37249c09885fa86b27a78554c7.zip
busybox-087b9d640ed66f37249c09885fa86b27a78554c7.tar.gz
Allow a user-configurable minimum password length.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Config.in7
-rw-r--r--libbb/obscure.c9
2 files changed, 9 insertions, 7 deletions
diff --git a/libbb/Config.in b/libbb/Config.in
index 3ddb7d9..c5406cb 100644
--- a/libbb/Config.in
+++ b/libbb/Config.in
@@ -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
diff --git a/libbb/obscure.c b/libbb/obscure.c
index d6a87b5..4a8fbf7 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -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 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
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 */