diff options
Diffstat (limited to 'whitelist.py')
-rw-r--r-- | whitelist.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/whitelist.py b/whitelist.py index fab0824..c017402 100644 --- a/whitelist.py +++ b/whitelist.py @@ -67,9 +67,12 @@ class whitelist(object): def checkfrom(self, fromhead): """have you permission to be here, sir?""" - for owner in self.wl.keys(): -# if(self.wl[owner]['From:'] == fromhead[:-1]): # remove '\n' +# if(self.wl[owner]['From'] == fromhead[:-1]): # remove '\n' + # here colon after 'From' IS required, because binary module wl + # expects it. + # TODO: when switching to the python lexxing, remove this + # limitation. if fromhead[:-1].find(self.wl[owner]['From:']) >= 0: return owner else: @@ -104,26 +107,26 @@ class whitelist(object): self.log.write('at %s (%s)\n' % (ltime, tzone)) if owner is not None: self.log.write('\tWLOwner: ' + owner + '\n') - self.log.write('\tFrom: ' + heads.get('From:', 'NOT PRESENT\n')) - self.log.write('\tSubject: ' + heads.get('Subject:', 'NOT PRESENT\n')) - self.log.write('\tSender: ' + heads.get('Sender:', 'NOT PRESENT\n')) - self.log.write('\tDate: ' + heads.get('Date:', 'NOT PRESENT\n')) + self.log.write('\tFrom: ' + heads.get('From', 'NOT PRESENT\n')) + self.log.write('\tSubject: ' + heads.get('Subject', 'NOT PRESENT\n')) + self.log.write('\tSender: ' + heads.get('Sender', 'NOT PRESENT\n')) + self.log.write('\tDate: ' + heads.get('Date', 'NOT PRESENT\n')) # some client create Message-Id other Message-ID. - if 'Message-ID:' in heads: - self.log.write('\tMessage-ID: ' + heads.get('Message-ID:')) + if 'Message-ID' in heads: + self.log.write('\tMessage-ID: ' + heads.get('Message-ID')) else: - self.log.write('\tMessage-Id: ' + heads.get('Message-Id:', + self.log.write('\tMessage-Id: ' + heads.get('Message-Id', 'NOT PRESENT\n')) # X-Newsgroups: and To: are present if user is trusted, else # Newsgroup: exists since no changes on nntp headers are done. - if 'X-Newsgroups:' in heads: - self.log.write('\tTo: ' + heads.get('To:', 'NOT PRESENT\n')) - self.log.write('\tX-Newsgroups: ' + heads.get('X-Newsgroups:', + if 'X-Newsgroups' in heads: + self.log.write('\tTo: ' + heads.get('To', 'NOT PRESENT\n')) + self.log.write('\tX-Newsgroups: ' + heads.get('X-Newsgroups', 'NOT PRESENT\n')) else: self.log.write('\tNewsgroups: ' + - heads.get('Newsgroups:', 'NOT PRESENT\n')) + heads.get('Newsgroups', 'NOT PRESENT\n')) self.log.write('\n') |