The above comments are fixed in the attached, as well as a pass over the docs and extended tests to actually test matching a foreign server. What do think about this version? I'm still not convinced that there aren't more quoting bugs in the parser, but I've left that intact for now.
The problematic points are double quotes and new line char. Any other is just in sequence of bytes.
I have just one note to your patch. When you use pg_strncasecmp, then you have to check the size too