From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: netsec 682578f 4/6: Add option to bypass NSM TLS checks on local networks Date: Tue, 17 Jul 2018 18:17:57 +0200 Message-ID: <87r2k1g7ka.fsf@gmail.com> References: <20180714170806.8972.58581@vcs0.savannah.gnu.org> <20180714170809.C3A3920456@vcs0.savannah.gnu.org> <87o9f84t89.fsf@gmail.com> <4C758D1D-7C3A-425A-852F-75E03C779E01@gmail.com> <87va9fs3ro.fsf@gmail.com> <83tvoz8bus.fsf@gnu.org> <87fu0jrvye.fsf@gmail.com> <83in5f833i.fsf@gnu.org> <87pnzm8989.fsf@gmail.com> <83o9f57tfz.fsf@gnu.org> <87va9dg8oa.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531844172 24383 195.159.176.226 (17 Jul 2018 16:16:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Jul 2018 16:16:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 17 18:16:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffSdy-0006DT-RW for ged-emacs-devel@m.gmane.org; Tue, 17 Jul 2018 18:16:06 +0200 Original-Received: from localhost ([::1]:60350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffSg5-0003IL-RV for ged-emacs-devel@m.gmane.org; Tue, 17 Jul 2018 12:18:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffSfs-0003GZ-UD for emacs-devel@gnu.org; Tue, 17 Jul 2018 12:18:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffSfo-0006Gm-Th for emacs-devel@gnu.org; Tue, 17 Jul 2018 12:18:04 -0400 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:56318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ffSfo-0006GL-Mp for emacs-devel@gnu.org; Tue, 17 Jul 2018 12:18:00 -0400 Original-Received: by mail-wm0-x233.google.com with SMTP id f21-v6so2102772wmc.5 for ; Tue, 17 Jul 2018 09:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version; bh=97W7fHnho5YZwQ8sIxFfp5OhNEDBwbHhYA52uyxFtXs=; b=UxMQD1zZ+i0TR6lEAc88v7fGHfCQZGfBTmY99UrRTMHJfWnY45wlL3+pMBBnp6ep+k BE0clQ6N344aRyfT0EWZuK8gII+sGif989T9kg3apN4izyjZ9+PeB7CipnrKiaDPzBKA PyrPDrYoNQhWwyL5wsrEFbAwz3ed5LFaArWs8/njHQHvxDaL8iJPVt7tNjc8I5MuX8LY HlhMH5AFNuUarjYerVtDB0p8nsU4gNFVtVrvP/ZiG65oCaPY1+u8dEO2b/Cox6CqJM8i bC7xAfzBHvN00NcQYXoKVzXNSnRuH3wYMyJKMdpsRdQlOuJ6IEzY9/ui6mZe9fxLgklH ZSXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:mail-followup-to :mail-copies-to:gmane-reply-to-list:date:in-reply-to:message-id :mime-version; bh=97W7fHnho5YZwQ8sIxFfp5OhNEDBwbHhYA52uyxFtXs=; b=h/A+xRMX9MvQiqyXEisn76pZT1e9eMdTiDUpA7SMq/ikMLMhFDNo7VGI8fxhLudd// Ve1V8OCT9UfZlkORRJ/TvDz4g2mr80gGsU78AoOA5iDowpi2E09cCyjXa/uB+K3XExGr O/KALaJ9p97sybAkuSco3ALXm0B6exk0dDee88EZ35cnxN2SVylcHENfl2hMeBGn9ZKC QviIdaDNH1ngdcDFmhpPW5Pt4iCwUvJ6uqPHJz9yScZYAWquilM15nctzVbWt62hziKQ FA8Pe+pFFHZYeq1RWQUEAezgJqVsmCVHwHfAwwjaWVGJxcxGA+tNvfNwWZcNK/XPjpHf 8ISQ== X-Gm-Message-State: AOUpUlFRR1mAKyhC+Z0qQtDgmAiarJDGyeLRz8PPpNwQIKl9yTFuHXpE MjwWswKBbGwgwTM01orUngIQXDJu X-Google-Smtp-Source: AAOMgpe3RxY8vHirPshzPD6YyDuOyDh63PpPZV0H2E3gd9pEpPeiYCKExlhtX12dGoR5NMUVShZx1w== X-Received: by 2002:a1c:c44a:: with SMTP id u71-v6mr1791335wmf.43.1531844279056; Tue, 17 Jul 2018 09:17:59 -0700 (PDT) Original-Received: from rpluim ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id c7-v6sm2490003wma.26.2018.07.17.09.17.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jul 2018 09:17:58 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <87va9dg8oa.fsf@gmail.com> (Robert Pluim's message of "Tue, 17 Jul 2018 17:53:57 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:227503 Archived-At: Robert Pluim writes: > Eli Zaretskii writes: > >>> From: Robert Pluim >>> Cc: emacs-devel@gnu.org >>> Date: Tue, 17 Jul 2018 12:09:10 +0200 >>> >>> Eli Zaretskii writes: >>> > >>> > Then I think we should test that it's either a unibyte string or a >>> > string whose size in bytes is equal to its size in characters, and >>> > signal an error if that doesn't hold. >>> >>> So I tried using STRING_MULTIBYTE, but of course eww uses >>> puny-encode-domain on unicode hostnames, and that returns a multibyte >>> string that only contains ASCII characters. Rather than opening that >>> can of worms, I settled on checking >>> >>> SBYTES (host) != SCHARS (host) >> >> This will signal an error for unibyte strings, because there SBYTES is >> always -1. So I think you should do this instead: >> > > Ah, I was assuming they'd always be in sync. > >> STRING_MULTIBYTE (host) && SBYTES (host) != SCHARS (host) > > OK, that works. I couldn't get my original to fail with a unibyte string. Turns out that even though size_byte is indeed -1 for unibyte strings, in that case SBYTES returns the size field: ptrdiff_t nbytes = s->u.s.size_byte < 0 ? s->u.s.size : s->u.s.size_byte; Having said that, testing for STRING_MULTIBYTE is harmless. Robert