Skip to content

Commit

Permalink
spammers seem to inject strange bytes into the headers
Browse files Browse the repository at this point in the history
try to decode all strings from postfix from utf8 to us-ascii
and drop all non-ascii chars
  • Loading branch information
evgeni committed Jul 12, 2010
1 parent 426590f commit 5b58ff7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions postfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def lineReceived(self, line):
else:
try:
(pkey, pval) = line.split('=', 1)
try:
pval = pval.decode('utf-8', 'ignore').encode('us-ascii', 'ignore')
except:
pass
self.params[pkey] = pval
except:
print 'Could not parse "%s"' % line
Expand Down

0 comments on commit 5b58ff7

Please sign in to comment.