]> granicus.if.org Git - postgresql/commit
Allow DOS-style line endings in ~/.pgpass files.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Nov 2016 21:17:19 +0000 (16:17 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Nov 2016 21:17:19 +0000 (16:17 -0500)
commit8951f92da48cb2866b9f694e91f57eeaac7489bb
treebbc3e1af78c311c60f872353ad5abfccbc51e924
parent0bc3ed98c08d01da1138886a06829a93f97c923e
Allow DOS-style line endings in ~/.pgpass files.

On Windows, libc will mask \r\n line endings for us, since we read the
password file in text mode.  But that doesn't happen on Unix.  People
who share password files across both systems might have \r\n line endings
in a file they use on Unix, so as a convenience, ignore trailing \r.
Per gripe from Josh Berkus.

In passing, put the existing check for empty line somewhere where it's
actually useful, ie after stripping the newline not before.

Vik Fearing, adjusted a bit by me

Discussion: <0de37763-5843-b2cc-855e-5d0e5df25807@agliodbs.com>
src/interfaces/libpq/fe-connect.c