Re: Add regular expression testing for user name mapping in the peer authentication TAP test

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add regular expression testing for user name mapping in the peer authentication TAP test
Date: 2022-10-15 03:11:28
Message-ID: Y0ok4AzB1XcYtzd5@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 14, 2022 at 06:31:15PM +0200, Drouvot, Bertrand wrote:
> while working on [1], I thought it could also be useful to add regular
> expression testing for user name mapping in the peer authentication TAP
> test.

Good idea now that we have a bit more coverage in the authentication
tests.

> +# Test with regular expression in user name map.
> +my $last_system_user_char = substr($system_user, -1);

This would attach to the regex the last character of the system user.
I would perhaps have used more characters than that (-3?), as substr()
with a negative number larger than the string given in input would
give the entire string. That's a nit, though.

> +# The regular expression does not match.
> +reset_pg_ident($node, 'mypeermap', '/^$', 'testmapuser');

This matches only an empty string, my brain gets that right?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-15 04:49:05 Re: thinko in basic_archive.c
Previous Message Michael Paquier 2022-10-15 02:41:08 Re: New "single-call SRF" APIs are very confusingly named