Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojKNy-0007DI-7W for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Oct 2022 13:05:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ojKNw-0001AU-2a for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Oct 2022 13:05:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojKNv-0001AL-ON for pgsql-hackers@lists.postgresql.org; Fri, 14 Oct 2022 13:05:55 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ojKNt-00059I-3q for pgsql-hackers@lists.postgresql.org; Fri, 14 Oct 2022 13:05:55 +0000 Received: by mail-wm1-x32b.google.com with SMTP id iv17so3027922wmb.4 for ; Fri, 14 Oct 2022 06:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LVzor0nFs54O9+qi2PuYZhziW4KJm9Y7b30urzSNQsY=; b=lJTJvH5QppH+qUYIU2ajkc6R23N8DRyW2Zn/mJv5renf1V9388YZY2qRadTe2+l71p AmWR/m5dHwARNIxA34Fm54vlW4Lv5rJqOAjSmEmo+YltOFfIEjbO1HIohK/OQuaLivtW r2XZY+mIUqBvG3KCcJVt5L/Noz05IXb/xBCjMNIO+ajckq8mD3KypCi4t1r0Rgd18TO4 9z1b1paStiIByV20Iap1jqGflyELyd1rZqSUPS49lDG9gy3do2z5t3MEj4fFyDr3lTrI 6WHZo3vFWILCtZLFy8DEX1dG/JDsQkiple3hbK1gD9bLL+T1Gw+lEQzz8IXYwDFWdh2z HdCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LVzor0nFs54O9+qi2PuYZhziW4KJm9Y7b30urzSNQsY=; b=L1fG/vi2UV/L128modjtLu56gokd2KiaEOjSPptOBJswTlL9am1LcBxKrw1gk+PvUX azBEWaRsyaaRRGHFnhasdgBs1dGMgqpfn6aZyVyAKaipCt+b9mF7Z6dTJDE6GNPhXoi9 ce65KsCjEn+e7gQ3OE+3pQ9H+B9yoq84Ra7mt8T7gWDHmUaPeJVbE6cCid0zOF+XOGmR xuAzqEnP+wI4xvr+bvUy5r+9ag7+jH5jZF6T4OuoSysPbD5LE0qckO8w3X848YOGN4Vm 0HBm4pfrgnMnqq7DXWaF5YehPIN3tV0gN+Q0RTLyKIP7rzMz54/m9iU4BtcxFUDmG4zf Azkw== X-Gm-Message-State: ACrzQf22LrFwqXETiaphN5G1LnF954ZymYEwc0uwny8YArlowCaDkxx9 mfoS6L+8ntBJFSoQpQAIKvo= X-Google-Smtp-Source: AMsMyM6ZI3TOh2AucMDCN+5TmqPLuamsb0OoDOfyoS+XHZRDCI5TtES4PdWscvJ1QtSOPvRVqEo17Q== X-Received: by 2002:a1c:2743:0:b0:3b3:f017:f23a with SMTP id n64-20020a1c2743000000b003b3f017f23amr10698419wmn.137.1665752751861; Fri, 14 Oct 2022 06:05:51 -0700 (PDT) Received: from [192.168.4.65] ([54.239.6.185]) by smtp.gmail.com with ESMTPSA id u7-20020adfed47000000b002286670bafasm1933327wro.48.2022.10.14.06.05.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Oct 2022 06:05:51 -0700 (PDT) Message-ID: <4f55303e-62c1-1072-61db-fbfb30bd66c8@gmail.com> Date: Fri, 14 Oct 2022 15:04:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf Content-Language: en-US To: Michael Paquier Cc: Tom Lane , Jacob Champion , PostgreSQL Hackers References: <4177827.1662684400@sss.pgh.pa.us> <572017.1663646973@sss.pgh.pa.us> <607af3c9-e45d-3941-41a2-d21065d6594b@gmail.com> From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 10/14/22 7:30 AM, Michael Paquier wrote: > On Wed, Oct 12, 2022 at 08:17:14AM +0200, Drouvot, Bertrand wrote: >> Indeed, ;-) > > So, I have spent the last two days looking at all that, studying the > structure of the patch and the existing HEAD code, Thanks! > The code could be split to tackle things step-by-step: > - One refactoring patch to introduce token_regcomp() and > token_regexec(), with the introduction of a new structure that > includes the compiled regexes. (Feel free to counterargue about the > use of AuthToken for this purpose, of course!) > - Plug in the refactored logic for the lists of role names and > database names in pg_hba.conf. > - Handle the case of single host entries in pg_hba.conf. > -- I agree to work step-by-step. While looking at it again now, I discovered that the new TAP test for the regexp on the hostname in ssl/002_scram.pl is failing on some of my tests environment (and not all..). So, I agree with the dedicated steps you are proposing and that the "host case" needs a dedicated attention. I'm not ignoring all the remarks you've just done up-thread, I'll address them and/or provide my feedback on them when I'll come back with the step-by-step sub patches. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com