Mercurial > dnsbl
comparison src/dnsbl.cpp @ 266:582cfb9c4031 stable-6-0-33
fix unauthenticated rate limit bug for empty mail from
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 21 Jul 2012 13:05:54 -0700 |
parents | e118fd2c6af0 |
children | f941563c2a95 |
comparison
equal
deleted
inserted
replaced
265:89578e4f9c87 | 266:582cfb9c4031 |
---|---|
1049 // to lower case. Some clients enclose the entire address in single quotes, | 1049 // to lower case. Some clients enclose the entire address in single quotes, |
1050 // so we strip those as well. We also remove the SRS and prvs coding. | 1050 // so we strip those as well. We also remove the SRS and prvs coding. |
1051 // | 1051 // |
1052 const char *to_lower_string(const char *email); | 1052 const char *to_lower_string(const char *email); |
1053 const char *to_lower_string(const char *email) { | 1053 const char *to_lower_string(const char *email) { |
1054 if (!email) return strdup("<>"); | |
1054 int n = strlen(email); | 1055 int n = strlen(email); |
1056 if (n == 0) return strdup("<>"); | |
1055 if (email[0] == '<') { | 1057 if (email[0] == '<') { |
1056 // assume it also ends with > | 1058 // assume it also ends with > |
1057 n -= 2; | 1059 n -= 2; |
1058 if (n < 1) return strdup(email); // return "<>" | 1060 if (n < 1) return strdup("<>"); |
1059 email++; | 1061 email++; |
1060 } | 1062 } |
1061 if ((email[0] == '\'') && (email[n-1] == '\'') && (n > 2)) { | 1063 if ((email[0] == '\'') && (email[n-1] == '\'') && (n > 2)) { |
1062 n -= 2; | 1064 n -= 2; |
1063 email++; | 1065 email++; |