(spam-reverse-ip-string): new function to reverse an IP
authorTeodor Zlatanov <tzz@lifelogs.com>
Tue, 21 Oct 2003 18:57:34 +0000 (18:57 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Tue, 21 Oct 2003 18:57:34 +0000 (18:57 +0000)
address in a string
(spam-check-blackholes): use spam-reverse-ip-string

lisp/ChangeLog
lisp/spam.el

index 34ccf4e..5e126b7 100644 (file)
@@ -1,3 +1,9 @@
+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
index 1b3bfb4..c21efe0 100644 (file)
@@ -756,6 +756,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 \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"))
@@ -768,14 +774,15 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        (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