Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jHBsC-0007pP-Ai for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 19:39:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jHBsB-0005f9-4P for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 19:39:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jHBsA-0005bc-Lb for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2020 19:39:30 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jHBs7-0002Hh-Dx for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2020 19:39:29 +0000 Received: by mail-qt1-x834.google.com with SMTP id t17so3238051qtn.12 for ; Wed, 25 Mar 2020 12:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dR0utQ9EGB0VvE1vdy28K/T34WNYTpOJU0JQJSPtrhc=; b=AFq2Dy1cbgH1SM4y5lPpPkzlaOBfKyksXqKOAqy5emt8KC412HYnm8n82d0m0AtJdw 9A9xywQ8AYML8hs8O7PYyIDdRfLHeHzLjASmyLaN1eyxtcO1+u5ezPjrHMhnAi3j5HJs HdgR1/6YKzJhsmkQp4ZHOB3l11GvRcz1o7hnG63XwU83KQnNxLXUc0Py66cgh3x51VEA Np5Y19VhBTyJfB4TVAPhmGE3cPbZynAjPdubRDzRHL/MP3meoAQ1BUorZQmxh9OcL8ZR CeHHqsdD0Mi6iRsQvlaVPOZpjIX4xrUdbAB5+8XXvdmNH6RkGfo8i/uvoMZLTymAoo4L miTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dR0utQ9EGB0VvE1vdy28K/T34WNYTpOJU0JQJSPtrhc=; b=XIYFp3+9VYs/IZZHZe8LESUPAU2BvsRrCurkuPhQKKuUQCGVf+gnE2pXydJEoFyTES LQ+Kq4CTYRMQ9KrUdm0TnXNM/Gxf823ZZmPSijjGxWZ0j4qjt0jHI8nj2jg0lw4I32XE oGtYjl8vgYFeQIPV8CGWZXYubDQe2NiZyxT1opco29mXvqXj44gYZIzgf/1S6oJHLi7X xMBnvrFd2pVRKIor7npbomswg7weyq5CICOch6N2NTQKcDVjUZM3kEQNyPOWWuhy63O5 f19xZn7T8A7YDUp8CT5R5U2HiyQnHYVv3lEvJHqOSEpzRUgcchiyq2HSe52JnwqBl0DD xqrA== X-Gm-Message-State: ANhLgQ1XKwE8l+8oebIPqK9BseFGAxDP7pWfFO85IfPYJK/4e7kSn3HM LREWIhzTWNI/838iudKCAmQZulek/iw= X-Google-Smtp-Source: ADFU+vsLupdrSirwCUoHA2oJPRS40nKbrJ2KHB8QqVUse4cBUicBPxq0URjMcrymWpZqzlCDJyMrRQ== X-Received: by 2002:aed:314c:: with SMTP id 70mr4384062qtg.334.1585165165940; Wed, 25 Mar 2020 12:39:25 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o186sm7274409qke.39.2020.03.25.12.39.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Mar 2020 12:39:25 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 3EB25800EBC; Wed, 25 Mar 2020 14:39:23 -0500 (CDT) Date: Wed, 25 Mar 2020 14:39:23 -0500 From: Justin Pryzby To: Fabien COELHO Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Allow continuations in "pg_hba.conf" files Message-ID: <20200325193923.GD21443@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On Wed, Mar 25, 2020 at 07:09:38PM +0100, Fabien COELHO wrote: > > Hello, > > After writing an unreadable and stupidly long line for ldap authentification > in a "pg_hba.conf" file, I figured out that allowing continuations looked > simple enough and should just be done. I tried this briefly. > - Records cannot be continued across lines. > + Records can be backslash-continued across lines. Maybe say: "lines ending with a backslash are logically continued on the next line", or similar. > + /* else we have a continuation, just blank it and loop */ > + continuations++; > + *curend++ = ' '; Since it puts a blank there, it creates a "word" boundary, which I gather worked for your use case. But I wonder whether it's needed to add a space (or otherwise, document that lines cannot be split beween words?). You might compare this behavior with that of makefiles (or find a better example) which I happen to recall *don't* add a space; if you want that, you have to end the line with: " \" not just "\". Anyway, I checked that the current patch handles users split across lines, like: alice,\ bob,\ carol As written, that depends on the parser's behavior of ignoring commas and blanks, since it sees: "alice,[SPACE]bob,[SPACE]carol" Maybe it'd be nice to avoid depending on that. I tried with a username called "alice,bob", split across lines: "alice,\ bob",\ But then your patch makes it look for a user called "alice, bob" (with a space). I realize that's not a compelling argument :) Note, that also appears to affect the "username maps" file. So mention in that chapter, too. https://www.postgresql.org/docs/current/auth-username-maps.html Cheers, -- Justin