From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: smtpmail and starttls improvement when starttls program is missing Date: Tue, 04 Nov 2008 09:53:17 +0900 Organization: Emacsen advocacy group Message-ID: References: <86wsfrayh9.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225760024 10616 80.91.229.12 (4 Nov 2008 00:53:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2008 00:53:44 +0000 (UTC) Cc: ding@gnus.org, emacs-devel@gnu.org To: Ted Zlatanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 04 01:54:46 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KxABy-00030d-HN for ged-emacs-devel@m.gmane.org; Tue, 04 Nov 2008 01:54:46 +0100 Original-Received: from localhost ([127.0.0.1]:35437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxAAr-0001gp-Hy for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2008 19:53:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxAAn-0001dw-5p for emacs-devel@gnu.org; Mon, 03 Nov 2008 19:53:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxAAm-0001d9-Fx for emacs-devel@gnu.org; Mon, 03 Nov 2008 19:53:32 -0500 Original-Received: from [199.232.76.173] (port=37717 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxAAm-0001cz-CW for emacs-devel@gnu.org; Mon, 03 Nov 2008 19:53:32 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]:60490) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxAAm-000333-5W for emacs-devel@gnu.org; Mon, 03 Nov 2008 19:53:32 -0500 Original-Received: from localhost ([127.0.0.1]:58361) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1KxAAg-0001gd-L3; Mon, 03 Nov 2008 18:53:27 -0600 X-Hashcash: 1:20:081104:tzz@lifelogs.com::ZsCn+YTIjFSLW1Li:03pqC X-Hashcash: 1:20:081104:emacs-devel@gnu.org::eUePshO4+a3YhQFU:0000000000000000000000000000000000000000001DIB X-Hashcash: 1:20:081104:ding@gnus.org::uxnTBPNwHlfgXdys:00000Hrn X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:8j9ln0P+qlMvNKik7HnSb+VOfgg= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:105319 gmane.emacs.gnus.general:67753 Archived-At: >>>>> Ted Zlatanov wrote: > Currently, smtpmail-open-stream will quietly fail if the starttls / > gnutls program is not available. The changes below (starttls diff is > against the Gnus trunk but it shouldn't matter) introduce the function > starttls-any-program-available which will return either starttls-program > or starttls-gnutls-program, whichever is usable. It also shows a > message, so a user can see in *Messages* that no STARTTLS protocol > transport is available. smtpmail-open-stream then uses the function, > simplifying the logic flow. > The message will only be shown when starttls-any-program-available is > called, but note that it is called by smtpmail-open-stream iff there is > a match for the server in smtpmail-starttls-credentials. This means the > user won't see the message unless he has an entry for the server that > implies he wants STARTTLS. > Let me know what you think... Thanks > Ted > Index: starttls.el > =================================================================== > RCS file: /usr/local/cvsroot/gnus/lisp/starttls.el,v > retrieving revision 7.19 > diff -c -r7.19 starttls.el > *** starttls.el 19 May 2008 08:47:42 -0000 7.19 > --- starttls.el 29 Oct 2008 21:15:29 -0000 > *************** > *** 295,300 **** > --- 295,314 ---- > (starttls-set-process-query-on-exit-flag process nil) > process))) > + (defun starttls-any-program-available () > + (let ((program (if starttls-use-gnutls > + starttls-gnutls-program > + starttls-program))) > + (condition-case () > + (with-no-warnings > + (require 'starttls) > + (call-process program) > + program) > + (error (progn > + (message "No STARTTLS program was available (tried '%s')" > + program) > + nil))))) > + > (provide 'starttls) > ;; arch-tag: 648b3bd8-63bd-47f5-904c-7c819aea2297 I think `with-no-warnings' and `(require 'starttls)' are unnecessary. For `with-no-warnings', it binds `byte-compile-warnings' to nil when compiling. It is for making the byte compiler silent on any form, however there seems nothing to be warned when compiling. In addition, `with-no-warnings' is not available in Emacs 21 and XEmacs that Gnus supports, so the warning like the following is issued when compiling Gnus: While compiling the end of the data in file gnus/lisp/starttls.el: ** The function `with-no-warnings' is not known to be defined. It is not serious since the function will not be used with those versions of Emacsen, though. For `(require 'starttls)', the reason I say it is unnecessary is that the function is defined in starttls.el that provides the `starttls' feature. ;-) Therefore the function can be rewritten like the following, isn't it? --8<---------------cut here---------------start------------->8--- (defun starttls-any-program-available () (let ((program (if starttls-use-gnutls starttls-gnutls-program starttls-program))) (condition-case () (progn (call-process program) program) (error (progn (message "No STARTTLS program was available (tried '%s')" program) nil))))) --8<---------------cut here---------------end--------------->8--- > Index: lisp/mail/smtpmail.el > =================================================================== > RCS file: /sources/emacs/emacs/lisp/mail/smtpmail.el,v > retrieving revision 1.105 > diff -c -r1.105 smtpmail.el > *** lisp/mail/smtpmail.el 7 Jun 2008 02:41:06 -0000 1.105 > --- lisp/mail/smtpmail.el 29 Oct 2008 21:16:26 -0000 > *************** > *** 503,515 **** > (defun smtpmail-open-stream (process-buffer host port) > (let ((cred (smtpmail-find-credentials > smtpmail-starttls-credentials host port))) > ! (if (null (and cred (condition-case () > ! (with-no-warnings > ! (require 'starttls) > ! (call-process (if starttls-use-gnutls > ! starttls-gnutls-program > ! starttls-program))) > ! (error nil)))) > ;; The normal case. > (open-network-stream "SMTP" process-buffer host port) > (let* ((cred-key (smtpmail-cred-key cred)) > --- 503,509 ---- > (defun smtpmail-open-stream (process-buffer host port) > (let ((cred (smtpmail-find-credentials > smtpmail-starttls-credentials host port))) > ! (if (null (and cred (starttls-any-program-available))) > ;; The normal case. > (open-network-stream "SMTP" process-buffer host port) > (let* ((cred-key (smtpmail-cred-key cred)) Regards,