From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/53117 Path: main.gmane.org!not-for-mail From: Tommi Vainikainen Newsgroups: gmane.emacs.gnus.general Subject: Patch to test message-alternative-emails do detect your posts when canceling Date: 12 Jun 2003 21:26:45 +0300 Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1055444351 7910 80.91.224.249 (12 Jun 2003 18:59:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2003 18:59:11 +0000 (UTC) Original-X-From: ding-owner+M1662@lists.math.uh.edu Thu Jun 12 20:59:07 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19QXHu-00022q-00 for ; Thu, 12 Jun 2003 20:59:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19QXJw-0008Dy-00; Thu, 12 Jun 2003 14:01:12 -0500 Original-Received: from sclp3.sclp.com ([64.157.176.121]) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19QWmm-00087J-00 for ding@lists.math.uh.edu; Thu, 12 Jun 2003 13:26:56 -0500 Original-Received: (qmail 20392 invoked by alias); 12 Jun 2003 18:26:56 -0000 Original-Received: (qmail 20387 invoked from network); 12 Jun 2003 18:26:55 -0000 Original-Received: from twilight.cs.hut.fi (root@130.233.40.5) by sclp3.sclp.com with SMTP; 12 Jun 2003 18:26:55 -0000 Original-Received: (from localhost user: 'tvainika' uid#31164 fake: STDIN (tvainika@kekkonen.cs.hut.fi)) by mail.niksula.cs.hut.fi id ; Thu, 12 Jun 2003 21:26:45 +0300 Fake-Sender: tvainika@niksula.hut.fi Mail-Copies-To: poster Original-To: ding@gnus.org Original-Lines: 20 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:53117 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:53117 --=-=-= Hello, I've made a patch to message.el to better detect if message you are trying to cancel (or supersede) is really yours. Personally I got annoyed, because I use gnus-posting-styles to change different addresses when posting to usenet. Now there is additional check by matching message-alternative-emails regexp (already existing variable) agains sender (grabbed from From field) email. I also separated common code from message-cancel-news and message-supersede to new function message-is-yours-p, because same code was duplicated. Patch is here: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=cancel.patch Index: ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 6.2420 diff -u -r6.2420 ChangeLog --- ChangeLog 10 Jun 2003 17:16:51 -0000 6.2420 +++ ChangeLog 12 Jun 2003 18:34:56 -0000 @@ -1,3 +1,9 @@ + * message.el (message-is-yours-p): New function. Separated common + code from message-cancel-news and message-supersede. Added + matching code which uses message-alternative-emails regexp as last + resort. + (message-cancel-news, message-supersede): Use message-is-yours-p. + 2003-06-10 Teodor Zlatanov * spam.el (spam-check-bogofilter-headers): fix for when the score Index: message.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v retrieving revision 6.350 diff -u -r6.350 message.el --- message.el 8 Jun 2003 22:17:05 -0000 6.350 +++ message.el 12 Jun 2003 18:34:58 -0000 @@ -5702,6 +5702,45 @@ cur))) +;;;###autoload +(defun message-is-yours-p () + "Non-nil means current article is yours. +If you have added 'cancel-messages to 'message-shoot-gnksa-feet', all articles +are yours except those that have Cancel-Lock header not belonging to you. +Instead of shooting GNKSA feet, you should modify 'message-alternative-emails' +regexp to match all of yours addresses." + ;; Canlock-logic as suggested by Per Abrahamsen + ;; + ;; + ;; IF article has cancel-lock THEN + ;; IF we can verify it THEN + ;; issue cancel + ;; ELSE + ;; error: cancellock: article is not yours + ;; ELSE + ;; Use old rules, comparing sender... + (if (message-fetch-field "Cancel-Lock") + (if (null (canlock-verify)) + t + (error "Failed to verify Cancel-lock: This article is not yours")) + (or + (message-gnksa-enable-p 'cancel-messages) + (and sender + (string-equal + (downcase sender) + (downcase (message-make-sender)))) + ;; Email address in From field equals to our address + (string-equal + (downcase (cadr (mail-extract-address-components from))) + (downcase (cadr (mail-extract-address-components + (message-make-from))))) + ;; Email address in From field matches + ;; 'message-alternative-emails' regexp + (and message-alternative-emails + (string-match + message-alternative-emails + (cadr (mail-extract-address-components from))))))) + ;;;###autoload (defun message-cancel-news (&optional arg) @@ -5721,31 +5760,7 @@ message-id (message-fetch-field "message-id" t) distribution (message-fetch-field "distribution"))) ;; Make sure that this article was written by the user. - (unless (or - ;; Canlock-logic as suggested by Per Abrahamsen - ;; - ;; - ;; IF article has cancel-lock THEN - ;; IF we can verify it THEN - ;; issue cancel - ;; ELSE - ;; error: cancellock: article is not yours - ;; ELSE - ;; Use old rules, comparing sender... - (if (message-fetch-field "Cancel-Lock") - (if (null (canlock-verify)) - t - (error "Failed to verify Cancel-lock: This article is not yours")) - nil) - (message-gnksa-enable-p 'cancel-messages) - (and sender - (string-equal - (downcase sender) - (downcase (message-make-sender)))) - (string-equal - (downcase (cadr (mail-extract-address-components from))) - (downcase (cadr (mail-extract-address-components - (message-make-from)))))) + (unless (message-is-yours-p) (error "This article is not yours")) (when (yes-or-no-p "Do you really want to cancel this article? ") ;; Make control message. @@ -5781,31 +5796,7 @@ (sender (message-fetch-field "sender")) (from (message-fetch-field "from"))) ;; Check whether the user owns the article that is to be superseded. - (unless (or - ;; Canlock-logic as suggested by Per Abrahamsen - ;; - ;; - ;; IF article has cancel-lock THEN - ;; IF we can verify it THEN - ;; issue cancel - ;; ELSE - ;; error: cancellock: article is not yours - ;; ELSE - ;; Use old rules, comparing sender... - (if (message-fetch-field "Cancel-Lock") - (if (null (canlock-verify)) - t - (error "Failed to verify Cancel-lock: This article is not yours")) - nil) - (message-gnksa-enable-p 'cancel-messages) - (and sender - (string-equal - (downcase sender) - (downcase (message-make-sender)))) - (string-equal - (downcase (cadr (mail-extract-address-components from))) - (downcase (cadr (mail-extract-address-components - (message-make-from)))))) + (unless (message-is-yours-p) (error "This article is not yours")) ;; Get a normal message buffer. (message-pop-to-buffer (message-buffer-name "supersede")) --=-=-= PS. Please Cc me, I do not read this list regularly. -- Tommi Vainikainen --=-=-=--