/[LeafOK_CVS]/lbbs/src/passwd.c
ViewVC logotype

Contents of /lbbs/src/passwd.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Mon Apr 28 04:23:54 2025 UTC (10 months, 2 weeks ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
Content type: text/x-csrc
FILE REMOVED
Remove legacy code

1 /***************************************************************************
2 passwd.c - description
3 -------------------
4 begin : Mon Oct 22 2004
5 copyright : (C) 2004 by Leaflet
6 email : leaflet@leafok.com
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include <string.h>
19
20 int verify_pass_complexity(const char *password, const char *username, int len)
21 {
22 int ch_repeat[128], i, verify_ok = 1, pass_len,
23 num_count = 0, upper_case = 0, lower_case = 0;
24
25 pass_len = strlen(password);
26
27 for (i = 0; i < 128; i++)
28 ch_repeat[i] = 0;
29
30 if (pass_len < len)
31 verify_ok = 0;
32 if (strstr(password, username) != NULL)
33 verify_ok = 0;
34 for (i = 0; i < pass_len && verify_ok == 1; i++)
35 {
36 ch_repeat[password[i]]++;
37 if (ch_repeat[password[i]] > 2)
38 verify_ok = 0;
39 if (isdigit(password[i]))
40 num_count++;
41 if (isupper(password[i]))
42 upper_case++;
43 if (islower(password[i]))
44 lower_case++;
45 if (num_count > 2)
46 verify_ok = 0;
47 }
48 if (upper_case == 0 || lower_case == 0 || num_count == 0)
49 verify_ok = 0;
50
51 return (verify_ok);
52 }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1