From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] gnutls: Add SNI support Date: Mon, 24 Nov 2014 13:28:49 +0100 Message-ID: <87oarwhjem.fsf@zigzag.favinet> References: <87wq6k3i99.fsf@toke.dk> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1416831911 32636 80.91.229.3 (24 Nov 2014 12:25:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Nov 2014 12:25:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 24 13:25:04 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XsshR-0005a5-3T for ged-emacs-devel@m.gmane.org; Mon, 24 Nov 2014 13:25:01 +0100 Original-Received: from localhost ([::1]:52282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsshQ-0000Hl-J5 for ged-emacs-devel@m.gmane.org; Mon, 24 Nov 2014 07:25:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsshH-0000HV-R2 for emacs-devel@gnu.org; Mon, 24 Nov 2014 07:24:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsshC-0001fL-2X for emacs-devel@gnu.org; Mon, 24 Nov 2014 07:24:51 -0500 Original-Received: from smtp208.alice.it ([82.57.200.104]:59658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsshB-0001fD-Mk for emacs-devel@gnu.org; Mon, 24 Nov 2014 07:24:45 -0500 Original-Received: from zigzag.favinet (79.40.71.96) by smtp208.alice.it (8.6.060.28) id 546F15850084A05B for emacs-devel@gnu.org; Mon, 24 Nov 2014 13:24:44 +0100 Original-Received: from ttn by zigzag.favinet with local (Exim 4.80) (envelope-from ) id 1XsslH-0000JH-Fx for emacs-devel@gnu.org; Mon, 24 Nov 2014 13:28:59 +0100 Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: <87wq6k3i99.fsf@toke.dk> ("Toke =?utf-8?Q?H=C3=B8iland-J?= =?utf-8?Q?=C3=B8rgensen=22's?= message of "Mon, 24 Nov 2014 13:17:22 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.104 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:178167 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable () Toke H=C3=B8iland-J=C3=B8rgensen () Mon, 24 Nov 2014 13:17:22 +0100 + char *c; bool send_hostname =3D 0; /* Placeholders for the property list elements. */ Lisp_Object priority_string; @@ -1375,6 +1381,22 @@ one trustfile (usually a CA bundle). */) if (ret < GNUTLS_E_SUCCESS) return gnutls_make_error (ret); + /* Quick and dirty test of the hostname; shouldn't be an IP. If it + contains letters, we assume it's a hostname, unless it contains a + : in which case we assume it's a literal IPv6 address. */ + for(c =3D c_hostname; c; c++) { + if(c >=3D 'a') send_hostname =3D 1; + if(c =3D=3D ':') {send_hostname =3D 0; break;} + } Aside from the whitespace and brace placement, this code is buggy: =E2=80= =98c=E2=80=99 is of type =E2=80=98char *=E2=80=99 and cannot be meaningfully compared dir= ectly to 'a'. =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) =3D> nil --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlRzJIUACgkQZwMiJEyAdQJqKACg0lKuZxKnAsIBfzno6JEhXpaq w90AnifepqW1q/G3kLpLAVi7WJtLYkH+ =C4/9 -----END PGP SIGNATURE----- --=-=-=--