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

Annotation of /lbbs/src/passwd.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide 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 sysadm 1.1 /***************************************************************************
2 sysadm 1.3 passwd.c - description
3     -------------------
4     begin : Mon Oct 22 2004
5     copyright : (C) 2004 by Leaflet
6     email : leaflet@leafok.com
7 sysadm 1.1 ***************************************************************************/
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 sysadm 1.3 int verify_pass_complexity(const char *password, const char *username, int len)
21 sysadm 1.1 {
22 sysadm 1.3 int ch_repeat[128], i, verify_ok = 1, pass_len,
23     num_count = 0, upper_case = 0, lower_case = 0;
24 sysadm 1.1
25 sysadm 1.3 pass_len = strlen(password);
26 sysadm 1.1
27 sysadm 1.3 for (i = 0; i < 128; i++)
28     ch_repeat[i] = 0;
29 sysadm 1.1
30 sysadm 1.3 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 sysadm 1.1
51 sysadm 1.3 return (verify_ok);
52 sysadm 1.1 }

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