+2003-10-21 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * spam.el (spam-reverse-ip-string): new function to reverse an IP
+ address in a string
+ (spam-check-blackholes): use spam-reverse-ip-string
+
2003-10-21 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-narrow-to-page): Clear as well as set the
\f
;;;; Blackholes.
+(defun spam-reverse-ip-string (ip)
+ (when (stringp ip)
+ (mapconcat 'identity
+ (nreverse (split-string ip "\\."))
+ ".")))
+
(defun spam-check-blackholes ()
"Check the Received headers for blackholed relays."
(let ((headers (nnmail-fetch-field "received"))
(while (re-search-forward
"\\[\\([0-9]+.[0-9]+.[0-9]+.[0-9]+\\)\\]" nil t)
(gnus-message 9 "Blackhole search found host IP %s." (match-string 1))
- (push (mapconcat 'identity
- (nreverse (split-string (match-string 1) "\\."))
- ".")
+ (push (spam-reverse-ip-string (match-string 1))
ips)))
(dolist (server spam-blackhole-servers)
(dolist (ip ips)
(unless (and spam-blackhole-good-server-regex
- (string-match spam-blackhole-good-server-regex ip))
+ ;; match the good-server-regex against the reversed (again) IP string
+ (string-match
+ spam-blackhole-good-server-regex
+ (spam-reverse-ip-string ip)))
(unless matches
(let ((query-string (concat ip "." server)))
(if spam-use-dig