From 2cfb8a64dcc55bfe53387dfed1721b803ef7bd3d Mon Sep 17 00:00:00 2001 From: dodger Date: Tue, 3 May 2022 10:15:32 +0200 Subject: [PATCH] Bugfix on the regex I miss the ! character --- passchanger.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/passchanger.sql b/passchanger.sql index 7eb6fc8..7c7ced5 100644 --- a/passchanger.sql +++ b/passchanger.sql @@ -52,7 +52,8 @@ declare begin select query into _invokingfunction from pg_stat_activity where pid = pg_backend_pid() ; -- raise notice 'Invoking function: %', _invokingfunction; - _matches := regexp_matches(_invokingfunction, E'select dba\.change_my_password\\(''([[:alnum:]]|@|\\$|#|%|\\^|&|\\*|\\(|\\)|\\_|\\+|\\{|\\}|\\||<|>|\\?|=){1,100}''\\)[[:space:]]{0,};' , 'i'); + --_matches := regexp_matches(_invokingfunction, E'select dba\.change_my_password\\(''([[:alnum:]]|@|\\$|#|%|\\^|&|\\*|\\(|\\)|\\_|\\+|\\{|\\}|\\||<|>|\\?|=){1,100}''\\)[[:space:]]{0,};' , 'i'); + _matches := regexp_matches(_invokingfunction, E'select dba\.change_my_password\\(''([[:alnum:]]|@|\\$|#|%|\\^|&|\\*|\\(|\\)|\\_|\\+|\\{|\\}|\\||<|>|\\?|=|!){11,100}''\\)[[:space:]]{0,};' , 'i'); -- raise notice 'Matches: %', _matches; if _matches IS NOT NULL then EXECUTE format('update pg_catalog.pg_authid set rolvaliduntil=now() + interval ''120 days'' where rolname=''%I'' ', _usename);