Closed stelb closed 2 hours ago
thx for the report @stelb! do you feel up to digging in and submitting a patch? if not, that's fine.
I think I found where that's happening, I had no idea right away how to fix. I'll try tomorrow
here is a stupid quickfix, to make it work for me right now https://github.com/ansible-collections/community.postgresql/compare/main...stelb:community.postgresql:dumbfix
the code assumes that any # starts a comment, it only affects the second line, because pg_hba is parsed and rewritten for each line. I'm not a regexp master, I was not yet successful to create something that matches every possibility. I am not even sure if it's possible.
there is a pg_hba parser by dalibo https://github.com/dalibo/pgtoolkit/blob/fe8db18923e934fc29b1393e0234976b346623f7/pgtoolkit/hba.py#L140 implementing this is not a 2-liner, and it's just a bordercase affecting only me .)
We should implement proper quote parsing, the ldapbindpasswd
is not the only value that can contain arbitrary characters.
The existing implementation of using '#' in line
is pretty naive.
I got a regexp for parsing respecting any quoted string and it works for me
Well escaped quotes are not handled..
hello folks, i put the help wanted
label.
For volunteers who wanna fix it, there were two attempts you can base your work on:
Vacant:)
SUMMARY
ldapbindpasswd in options which includes '#' creates faulty pg_hba lines While a hashmark in a password might be ugly I cannot change this
ISSUE TYPE
COMPONENT NAME
postgresql_pg_hba
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
file pg_hba should be:
ACTUAL RESULTS
pg_hba.conf generated is: