git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da5800d)
Track behavior of 1円 in pg_ident.conf when quoted
2023年1月17日 04:41:09 +0000 (13:41 +0900)
2023年1月17日 04:41:09 +0000 (13:41 +0900)
Entries of pg-user in pg_ident.conf that are quoted and include '1円'
allow a replacement from a subexpression in a system user regexp. This
commit adds a test to track this behavior and a note in the
documentation, as it could be affected by the use of an AuthToken for
the pg-user in the IdentLines parsed.

This subject has come up in the discussion aimed at extending the
support of pg-user in ident entries for more patterns.

Author: Jelte Fennema
Discussion: https://postgr.es/m/CAGECzQRNow4MwkBjgPxywXdJU_K3a9+Pm78JB7De3yQwwkTDew@mail.gmail.com


diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml
index cc8c59206c906118c79099f2c28f04d2f08f91a8..e4959663c4fcda2f1b95ba4eec1f03ebed42881f 100644 (file)
--- a/doc/src/sgml/client-auth.sgml
+++ b/doc/src/sgml/client-auth.sgml
@@ -960,6 +960,9 @@ mymap /^(.*)@otherdomain\.com$ guest
will remove the domain part for users with system user names that end with
<literal>@mydomain.com</literal>, and allow any user whose system name ends with
<literal>@otherdomain.com</literal> to log in as <literal>guest</literal>.
+ Quoting a <replaceable>database-username</replaceable> containing
+ <literal>1円</literal> <emphasis>does not</emphasis> make
+ <literal>1円</literal> lose its special meaning.
</para>
<tip>
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index 966b2aa47efaf35105da79876e9130f2541de995..e6f5fdba165619314700722e5d053f702c9d8f13 100644 (file)
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -153,6 +153,19 @@ test_role(
log_like =>
[qr/connection authenticated: identity="$system_user" method=peer/]);
+# Success as the regular expression matches and 1円 is replaced in the given
+# subexpression, even if quoted.
+reset_pg_ident($node, 'mypeermap', qq{/^$system_user(.*)\$},
+ '"test1円mapuser"');
+test_role(
+ $node,
+ qq{testmapuser},
+ 'peer',
+ 0,
+ 'with regular expression in user name map with quoted 1円 replaced',
+ log_like =>
+ [qr/connection authenticated: identity="$system_user" method=peer/]);
+
# Failure as the regular expression does not include a subexpression, but
# the database user contains 1,円 requesting a replacement.
reset_pg_ident($node, 'mypeermap', qq{/^$system_user\$}, '1円testmapuser');
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /