Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite753ae6

Browse files
committed
Add tests for regex replacement with \1 in pg_ident.conf to 0003_peer.pl
Regexp replacement with \1 in pg_ident.conf is tested in one check ofthe kerberos test suite, still it requires a dependency on--with-gssapi to be triggered. This commit adds to the test suite ofpeer authentication two tests to check the replacement of \1 in apg-username, coupled with a system-username regexp:- With a subexpression in system-username, similarly to the kerberostest suite.- Without a subexpression in system-username, checking for a failure.This had no coverage until now, and the error pattern is checked in theserver logs.Author: Jelte FennemaDiscussion:https://postgr.es/m/CAGECzQRNow4MwkBjgPxywXdJU_K3a9+Pm78JB7De3yQwwkTDew@mail.gmail.com
1 parent58597ed commite753ae6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎src/test/authentication/t/003_peer.pl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,30 @@ sub find_in_log
141141
[qr/connection authenticated: identity="$system_user" method=peer/]);
142142

143143

144+
# Success as the regular expression matches and \1 is replaced in the given
145+
# subexpression.
146+
reset_pg_ident($node,'mypeermap',qq{/^$system_user(.*)\$},'test\1mapuser');
147+
test_role(
148+
$node,
149+
qq{testmapuser},
150+
'peer',
151+
0,
152+
'with regular expression in user name map with \1 replaced',
153+
log_like=>
154+
[qr/connection authenticated: identity="$system_user" method=peer/]);
155+
156+
# Failure as the regular expression does not include a subexpression, but
157+
# the database user contains \1, requesting a replacement.
158+
reset_pg_ident($node,'mypeermap',qq{/^$system_user\$},'\1testmapuser');
159+
test_role(
160+
$node,
161+
qq{testmapuser},
162+
'peer', 2,
163+
'with regular expression in user name map with \1 not replaced',
164+
log_like=> [
165+
qr/regular expression "\^$system_user\$" has no subexpressions as requested by backreference in "\\1testmapuser"/
166+
]);
167+
144168
# Concatenate system_user to system_user.
145169
$regex_test_string =$system_user .$system_user;
146170

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp