Mercurial > dnsbl
diff src/dnsbl.cpp @ 127:2b1a4701e856
sendmail no longer guarantees <> wrapper on envelopes
author | carl |
---|---|
date | Sat, 08 Apr 2006 10:06:09 -0700 |
parents | 05ae49d37896 |
children | 9ab51896447f |
line wrap: on
line diff
--- a/src/dnsbl.cpp Sat Mar 25 09:47:08 2006 -0800 +++ b/src/dnsbl.cpp Sat Apr 08 10:06:09 2006 -0700 @@ -855,16 +855,24 @@ } //////////////////////////////////////////////// -// this email address is passed in from sendmail, and will -// always be enclosed in <>. It may have mixed case, just -// as the mail client sent it. We dup the string and convert -// the duplicate to lower case. +// +// this email address is passed in from sendmail, and will normally be +// enclosed in <>. I think older versions of sendmail supplied the <> +// wrapper if the mail client did not, but the current version does not do +// that. So the <> wrapper is now optional. It may have mixed case, just +// as the mail client sent it. We dup the string and convert the duplicate +// to lower case. // char *to_lower_string(char *email); char *to_lower_string(char *email) { - int n = strlen(email)-2; - if (n < 1) return strdup(email); - char *key = strdup(email+1); + int n = strlen(email); + if (*email == '<') { + // assume it also ends with > + n -= 2; + if (n < 1) return strdup(email); // return "<>" + email++; + } + char *key = strdup(email); key[n] = '\0'; for (int i=0; i<n; i++) key[i] = tolower(key[i]); return key;