From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] GnuTLS support on Woe32 Date: Wed, 23 Mar 2011 10:23:42 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87lj05svwh.fsf@lifelogs.com> References: <87ipvwl1nx.wl%claudio.bley@gmail.com> <83oc5ogp89.fsf@gnu.org> <87ipvuwslp.wl%claudio.bley@gmail.com> <87hbbc0zi6.wl%claudio.bley@gmail.com> <83oc5gsdwc.fsf@gnu.org> <87ei6bunxz.wl%claudio.bley@gmail.com> <83tyf6rhgn.fsf@gnu.org> <84zkoy6tah.wl%claudio.bley@gmail.com> <87hbb5a4xq.fsf@lifelogs.com> <84ipvkx1da.wl%claudio.bley@gmail.com> <87d3ls7n3b.fsf@lifelogs.com> <87vczdwjuk.wl%claudio.bley@gmail.com> <87k4fr3koi.fsf@lifelogs.com> <87aagn2tpr.fsf@lifelogs.com> <87wrjquacf.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1300893854 6559 80.91.229.12 (23 Mar 2011 15:24:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 23 Mar 2011 15:24:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 23 16:24:10 2011 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.69) (envelope-from ) id 1Q2Pur-00072B-Nq for ged-emacs-devel@m.gmane.org; Wed, 23 Mar 2011 16:24:10 +0100 Original-Received: from localhost ([127.0.0.1]:44450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2Puq-00013A-UT for ged-emacs-devel@m.gmane.org; Wed, 23 Mar 2011 11:24:09 -0400 Original-Received: from [140.186.70.92] (port=54642 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2Pug-000107-Up for emacs-devel@gnu.org; Wed, 23 Mar 2011 11:24:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2Puf-0003d5-Ap for emacs-devel@gnu.org; Wed, 23 Mar 2011 11:23:58 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:55567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2Puf-0003cg-0t for emacs-devel@gnu.org; Wed, 23 Mar 2011 11:23:57 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q2Puc-0006rN-SU for emacs-devel@gnu.org; Wed, 23 Mar 2011 16:23:54 +0100 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Mar 2011 16:23:54 +0100 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Mar 2011 16:23:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 133 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:cMSCKWpRBltFUy2iZLiZHqomjiM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:137576 Archived-At: On Tue, 22 Mar 2011 21:20:21 -0400 Stefan Monnier wrote: >> Because of the way SSL and TLS work, the connection may start out >> unencrypted and the upgrade is sort of opportunistic. So we don't know >> in advance if we'll need the `gnutls-hostname'. SM> I must be missing something: the code seems to read `gnutls-hostname' SM> right after reading the keyword arguments, so it behaves just like SM> a keyword argument AFAICT. And the caller of gnutls-boot seems to set SM> it just before calling gnutls-negotiate/gnutls-boot so it seems that SM> from the caller's POV it could also be replaced by an additional SM> argument to gnutls-boot/negotiate. Oh, and it was buggy too :) Sorry for putting up crappy code but I honestly thought it was a good approach at the time. The latest patch ("revised 2011-03-23" posted this morning) does it better, simply using an extra :hostname parameter to `gnutls-negotiate'. Thanks for explaining about `process-put' and `process-get' (which I had completely forgotten). I appreciate your patience. >> Sorry this patch is getting so large. I'll try to fix all the issues >> ASAP. We need Claudio Bley's papers too, right? SM> I don't know, I haven't tracked what comes from where. The ChangeLog diffs (appended) explain: - Claudio and I worked on src/gnutls.c and lisp/net/gnutls.el; my work was to add callback support (though it is unused yet at the C level) and certificate and hostname verification. - Claudio did everything else (W32 support plus some bug fixes) The only remaining annoyance for me is that Claudio's code does logging in a non-standard way, ignoring `gnutls-log-level', so thousands of warnings get logged while the connections is being retried. I mentioned that to him and I'll see that it's fixed before this patch goes in. Ted === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-03-12 19:19:47 +0000 +++ lib-src/ChangeLog 2011-03-22 17:49:45 +0000 @@ -1,3 +1,7 @@ +2011-03-06 Claudio Bley + + * makefile.w32-in (obj): Added gnutls.o. + 2011-03-03 Drake Wilson (tiny change) * emacsclient.c (longopts): Add quiet. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-03-22 15:38:40 +0000 +++ lisp/ChangeLog 2011-03-22 17:50:32 +0000 @@ -1,3 +1,18 @@ +2011-03-22 Teodor Zlatanov + + * net/gnutls.el (gnutls-hostname): New buffer-local variable for + hostname verification. + (gnutls-negotiate): Add verify-flags, verify-error, and + verify-hostname-error. + (open-gnutls-stream): Add usage example. + +2011-03-22 Claudio Bley + + * net/gnutls.el (gnutls-negotiate): Check whether default + trustfile exists before going to use it. Add missing argument to + gnutls-message-maybe call. Return return value. + + 2011-03-22 Leo Liu * abbrev.el (write-abbrev-file): Use utf-8 for writing if it can === modified file 'nt/ChangeLog' --- nt/ChangeLog 2011-03-12 19:19:47 +0000 +++ nt/ChangeLog 2011-03-22 17:49:45 +0000 @@ -1,3 +1,10 @@ +2011-03-06 Claudio Bley + + * configure.bat: New options --without-gnutls and --lib, new build + variable USER_LIBS, automatically detect GnuTLS. + * INSTALL: Add instructions for GnuTLS support. + * gmake.defs: Prefix USER_LIB's with -l. + 2011-02-27 Eli Zaretskii * inc/unistd.h (readlink, symlink): Declare prototypes. === modified file 'src/ChangeLog' --- src/ChangeLog 2011-03-20 23:58:23 +0000 +++ src/ChangeLog 2011-03-22 17:49:45 +0000 @@ -1,3 +1,37 @@ +2011-03-22 Teodor Zlatanov + + * gnutls.c: Renamed global_initialized to + gnutls_global_initialized. Added internals for the + :verify-hostname-error, :verify-error, and :verify-flags + parameters of `gnutls-boot' and documented those parameters in the + docstring. Start callback support. + +2011-03-20 Claudio Bley + + * w32.h: (emacs_gnutls_pull): Add prototype. + (emacs_gnutls_push): Likewise. + + * w32.c: (emacs_gnutls_pull): New function for GnuTLS on Woe32. + (emacs_gnutls_push): Likewise. + + * process.c (wait_reading_process_output): Check if GnuTLS + buffered some data internally if no FDs are set for TLS + connections. + + * makefile.w32-in (OBJ2): Add gnutls.$(O). + (LIBS): Link to USER_LIBS. + ($(BLD)/gnutls.$(0)): New target. + + * gnutls.c (emacs_gnutls_handle_error): New function. + (wsaerror_to_errno): Likewise. + (emacs_gnutls_handshake): Add Woe32 support. Retry handshake + unless a fatal error occured. Call gnutls_alert_send_appropriate + on error. Return error code. + (emacs_gnutls_write): Call emacs_gnutls_handle_error. + (emacs_gnutls_read): Likewise. + (Fgnutls_boot): Return handshake error code. + + 2011-03-20 Glenn Morris * config.in: Remove file.