aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorrpjday <rpjday@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-07-02 18:35:39 +0000
committerrpjday <rpjday@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-07-02 18:35:39 +0000
commitead6c3d4c31d23fc46e60ab4c7f40303fa883b58 (patch)
tree2186495a0096f2adeb2691f749efe83b9b6d881e /libbb
parent055dc14045b950f58db159a52158d6956f632403 (diff)
downloadbusybox-w32-ead6c3d4c31d23fc46e60ab4c7f40303fa883b58.tar.gz
busybox-w32-ead6c3d4c31d23fc46e60ab4c7f40303fa883b58.tar.bz2
busybox-w32-ead6c3d4c31d23fc46e60ab4c7f40303fa883b58.zip
Allow a user-configurable minimum password length.
git-svn-id: svn://busybox.net/trunk/busybox@15580 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 3ddb7d96c..c5406cbb9 100644
--- a/libbb/Config.in
+++ b/libbb/Config.in
@@ -5,6 +5,13 @@
5 5
6menu "Busybox Library Tuning" 6menu "Busybox Library Tuning"
7 7
8config CONFIG_PASSWORD_MINLEN
9 int "Minimum password length"
10 default 6
11 range 5 32
12 help
13 Minimum allowable password length.
14
8config CONFIG_MD5_SIZE_VS_SPEED 15config CONFIG_MD5_SIZE_VS_SPEED
9 int " MD5: Trade Bytes for Speed" 16 int " MD5: Trade Bytes for Speed"
10 default 2 17 default 2
diff --git a/libbb/obscure.c b/libbb/obscure.c
index d6a87b5de..4a8fbf72c 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -46,11 +46,6 @@
46 46
47#include "libbb.h" 47#include "libbb.h"
48 48
49
50/* passwords should consist of 6 (to 8 characters) */
51#define MINLEN 6
52
53
54static int string_checker_helper(const char *p1, const char *p2) __attribute__ ((__pure__)); 49static int string_checker_helper(const char *p1, const char *p2) __attribute__ ((__pure__));
55 50
56static int string_checker_helper(const char *p1, const char *p2) 51static 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
101 int length; 96 int length;
102 int mixed = 0; 97 int mixed = 0;
103 /* Add 1 for each type of characters to the minlen of password */ 98 /* Add 1 for each type of characters to the minlen of password */
104 int size = MINLEN + 8; 99 int size = CONFIG_PASSWORD_MINLEN + 8;
105 const char *p; 100 const char *p;
106 char hostname[255]; 101 char hostname[255];
107 102
108 /* size */ 103 /* size */
109 if (!new_p || (length = strlen(new_p)) < MINLEN) 104 if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN)
110 return("too short"); 105 return("too short");
111 106
112 /* no username as-is, as sub-string, reversed, capitalized, doubled */ 107 /* no username as-is, as sub-string, reversed, capitalized, doubled */