Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/libbb/obscure.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/libbb/obscure.c
r821 r1770 40 40 */ 41 41 42 #include <ctype.h>43 #include <unistd.h>44 #include <string.h>45 #include <strings.h>46 47 42 #include "libbb.h" 48 49 50 /* passwords should consist of 6 (to 8 characters) */51 #define MINLEN 652 53 43 54 44 static int string_checker_helper(const char *p1, const char *p2) __attribute__ ((__pure__)); … … 72 62 int ret = string_checker_helper(p1, p2); 73 63 /* Make our own copy */ 74 char *p = bb_xstrdup(p1);64 char *p = xstrdup(p1); 75 65 /* reverse string */ 76 66 size = strlen(p); … … 101 91 int length; 102 92 int mixed = 0; 103 /* Add 1for each type of characters to the minlen of password */104 int size = MINLEN + 8;93 /* Add 2 for each type of characters to the minlen of password */ 94 int size = CONFIG_PASSWORD_MINLEN + 8; 105 95 const char *p; 106 96 char hostname[255]; 107 97 108 98 /* size */ 109 if (!new_p || (length = strlen(new_p)) < MINLEN)110 return ("too short");99 if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) 100 return "too short"; 111 101 112 102 /* no username as-is, as sub-string, reversed, capitalized, doubled */ … … 168 158 } 169 159 170 int obscure(const char *old, const char *newval, const struct passwd *pw dp)160 int obscure(const char *old, const char *newval, const struct passwd *pw) 171 161 { 172 162 const char *msg; 173 163 174 if ((msg = obscure_msg(old, newval, pwdp))) {175 printf("Bad password: %s.\n", msg);176 /* If user is root warn only */177 return (getuid())? 1 : 0;164 msg = obscure_msg(old, newval, pw); 165 if (msg) { 166 printf("Bad password: %s\n", msg); 167 return 1; 178 168 } 179 169 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.