Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/libbb/obscure.c


Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/libbb/obscure.c

    r821 r1765  
    4040*/
    4141
    42 #include <ctype.h>
    43 #include <unistd.h>
    44 #include <string.h>
    45 #include <strings.h>
    46 
    4742#include "libbb.h"
    48 
    49 
    50 /* passwords should consist of 6 (to 8 characters) */
    51 #define MINLEN 6
    52 
    5343
    5444static int string_checker_helper(const char *p1, const char *p2) __attribute__ ((__pure__));
     
    7262    int ret = string_checker_helper(p1, p2);
    7363    /* Make our own copy */
    74     char *p = bb_xstrdup(p1);
     64    char *p = xstrdup(p1);
    7565    /* reverse string */
    7666    size = strlen(p);
     
    10191    int length;
    10292    int mixed = 0;
    103     /* Add 1 for 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;
    10595    const char *p;
    10696    char hostname[255];
    10797
    10898    /* 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";
    111101
    112102    /* no username as-is, as sub-string, reversed, capitalized, doubled */
     
    168158}
    169159
    170 int obscure(const char *old, const char *newval, const struct passwd *pwdp)
     160int obscure(const char *old, const char *newval, const struct passwd *pw)
    171161{
    172162    const char *msg;
    173163
    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;
    178168    }
    179169    return 0;
Note: See TracChangeset for help on using the changeset viewer.