[PATCH] sanitize email address in comments

David Pashley <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
This probably isn't needed, but I figured it wouldn't hurt. My comments
had been attacked, but the comments didn't allow any spam to be sent.

Included is my patch for a simple turing test using a checkbox

--- /tmp/comments.py    2005-04-09 08:02:34.000000000 +0100
+++ plugins/comments.py 2006-03-14 23:42:31.967782000 +0000
@@ -363,7 +363,7 @@
     author = escape_SMTP_commands(clean_author(comment['author']))
     description = escape_SMTP_commands(comment['description'])
     if comment.has_key('email'):
-        email = comment['email']
+        email = escape_SMTP_commands(clean_author(comment['email']))
     else:
         email = config['comment_smtp_from']
     try:
@@ -540,8 +540,8 @@
                  'description' : add_dont_follow(body, config) }
         if form.has_key('email'):
             cdict['email'] = form['email'].value
-
-        data["comment_message"] = writeComment(request, config, data, \
+        if form.has_key('human'):
+            data["comment_message"] = writeComment(request, config, data, \
                                                 cdict, encoding)
 def escape_link(linkstring):
     """Don't allow html in the link string"""

  

-- 
David Pashley
[email protected]
Nihil curo de ista tua stulta superstitione.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.