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

Annotation of /lbbs/src/passwd.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Sun Mar 20 17:37:14 2005 UTC (21 years ago) by sysadm
Branch: MAIN
CVS Tags: lbbs_1-0-0-0_MIL
Changes since 1.1: +2 -2 lines
Content type: text/x-csrc
*** empty log message ***

1 sysadm 1.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
21     verify_pass_complexity (const char *password, const char *username, int len)
22     {
23     int ch_repeat[128], i, verify_ok = 1, pass_len,
24     num_count = 0, upper_case = 0, lower_case = 0;
25    
26     pass_len = strlen (password);
27    
28     for (i = 0; i < 128; i++)
29     ch_repeat[i] = 0;
30    
31     if (pass_len < len)
32     verify_ok = 0;
33     if (strstr (password, username) != NULL)
34     verify_ok = 0;
35     for (i = 0; i < pass_len && verify_ok == 1; i++)
36     {
37     ch_repeat[password[i]]++;
38     if (ch_repeat[password[i]] > 2)
39     verify_ok = 0;
40     if (isdigit (password[i]))
41     num_count++;
42 sysadm 1.2 if (isupper (password[i]))
43 sysadm 1.1 upper_case++;
44 sysadm 1.2 if (islower (password[i]))
45 sysadm 1.1 lower_case++;
46     if (num_count > 2)
47     verify_ok = 0;
48     }
49     if (upper_case == 0 || lower_case == 0 || num_count == 0)
50     verify_ok = 0;
51    
52     return (verify_ok);
53     }

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