]>
Commit | Line | Data |
---|---|---|
edb26b39 P |
1 | # HG changeset patch |
2 | # Parent d7905eb87f42cac8a0ca4281ec96e2a8c767ef4b | |
3 | ||
4 | diff -r d7905eb87f42 ircd/s_auth.c | |
5 | --- a/ircd/s_auth.c Sun Jul 14 23:14:33 2013 +0100 | |
6 | +++ b/ircd/s_auth.c Sun Jul 14 23:16:55 2013 +0100 | |
7 | @@ -224,13 +224,10 @@ | |
8 | char *s; | |
9 | int rlen = USERLEN; | |
10 | int killreason; | |
11 | - short upper = 0; | |
12 | - short lower = 0; | |
13 | + short character = 0; | |
14 | short pos = 0; | |
15 | - short leadcaps = 0; | |
16 | short other = 0; | |
17 | short digits = 0; | |
18 | - short digitgroups = 0; | |
19 | char ch; | |
20 | char last; | |
21 | char *reason; | |
22 | @@ -288,27 +285,13 @@ | |
23 | (ch = *d++) != '\0'; | |
24 | pos++, last = ch) | |
25 | { | |
26 | - if (IsLower(ch)) | |
27 | + if (IsLower(ch) || IsUpper(ch)) | |
28 | { | |
29 | - lower++; | |
30 | - } | |
31 | - else if (IsUpper(ch)) | |
32 | - { | |
33 | - upper++; | |
34 | - /* Accept caps as leading if we haven't seen lower case or digits yet. */ | |
35 | - if ((leadcaps || pos == 0) && !lower && !digits) | |
36 | - leadcaps++; | |
37 | + character++; | |
38 | } | |
39 | else if (IsDigit(ch)) | |
40 | { | |
41 | digits++; | |
42 | - if (pos == 0 || !IsDigit(last)) | |
43 | - { | |
44 | - digitgroups++; | |
45 | - /* If more than two groups of digits, reject. */ | |
46 | - if (digitgroups > 2) | |
47 | - goto badid; | |
48 | - } | |
49 | } | |
50 | else if (ch == '-' || ch == '_' || ch == '.') | |
51 | { | |
52 | @@ -321,20 +304,8 @@ | |
53 | goto badid; | |
54 | } | |
55 | ||
56 | - /* If mixed case, first must be capital, but no more than three; | |
57 | - * but if three capitals, they must all be leading. */ | |
58 | - if (lower && upper && (!leadcaps || leadcaps > 3 || | |
59 | - (upper > 2 && upper > leadcaps))) | |
60 | - goto badid; | |
61 | - /* If two different groups of digits, one must be either at the | |
62 | - * start or end. */ | |
63 | - if (digitgroups == 2 && !(IsDigit(s[0]) || IsDigit(ch))) | |
64 | - goto badid; | |
65 | /* Must have at least one letter. */ | |
66 | - if (!lower && !upper) | |
67 | - goto badid; | |
68 | - /* Final character must not be punctuation. */ | |
69 | - if (!IsAlnum(last)) | |
70 | + if (!character) | |
71 | goto badid; | |
72 | } | |
73 |