/* vi: set sw=4 ts=4: */
/*
* Copyright 1989 - 1994, Julianne Frances Haugh <jockgrrl@austin.rr.com>
+ * Copyright 2006, Bernhard Fischer <busybox@busybox.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
static int simple(const char *newval)
{
- int digits = 0;
- int uppers = 0;
- int lowers = 0;
- int others = 0;
- int c;
+#define digits 1
+#define uppers 2
+#define lowers 3
+#define others 4
+ int c, is_simple = 0;
int size;
int i;
for (i = 0; (c = *newval++) != 0; i++) {
if (isdigit(c))
- digits = c;
+ is_simple |= digits;
else if (isupper(c))
- uppers = c;
+ is_simple |= uppers;
else if (islower(c))
- lowers = c;
+ is_simple |= lowers;
else
- others = c;
+ is_simple |= others;
}
/*
*/
size = 9;
- if (digits)
+ if (is_simple & digits)
size--;
- if (uppers)
+ if (is_simple & uppers)
size--;
- if (lowers)
+ if (is_simple & lowers)
size--;
- if (others)
+ if (is_simple & others)
size--;
if (size <= i)
return 0;
return 1;
+#undef digits
+#undef uppers
+#undef lowers
+#undef others
}
static char *str_lower(char *string)
msg = "rotated";
}
- bzero(newmono, strlen(newmono));
- bzero(wrapped, lenwrap * 2);
+ memset(newmono, 0, strlen(newmono));
+ memset(wrapped, 0, lenwrap * 2);
free(newmono);
free(wrapped);
msg = password_check(old1, new1, pwdp);
- bzero(new1, newlen);
- bzero(old1, oldlen);
+ memset(new1, 0, newlen);
+ memset(old1, 0, oldlen);
free(new1);
free(old1);