Remove line length restriction in passwordFromFile()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Fujii Masao <fujii@postgresql.org>
Date: 2020-08-31T21:24:01Z
Lists: pgsql-hackers
Attachments
- remove-fixed-buffer-in-passwordFromFile.patch (text/x-diff) patch
Per the discussion at [1], we're now aware of actual use-cases for password strings approaching a kilobyte in length. I think this puts the final nail in the coffin of the idea that passwordFromFile() can use a fixed-length line buffer. Therefore, commit 2eb3bc588 (which added a warning for overlength lines) seems rather misguided in hindsight. What we should do instead is fix that code so it has no hard upper bound on the line length. Even if you want to say that we'll set a particular limit on how long the password field can be, there's no good upper bound for the length of the hostname field; so ISTM that just getting out of the business of a fixed-size buffer is the sanest way. Hence, the attached proposed patch does that, and for good measure adds some testing of this formerly untested code. Since we now have an actual user complaint, I'm inclined to back-patch this all the way. As noted in the other thread, there may be some other changes needed to support long passwords, but this is clearly required. regards, tom lane [1] https://www.postgresql.org/message-id/flat/CAOhmDze1nqG2vfegpSsTFCgaiFRsqgjO6yLsbmhroz2zGmJHog%40mail.gmail.com
Commits
-
Teach libpq to handle arbitrary-length lines in .pgpass files.
- df8020b329eb 11.10 landed
- ba23174dd916 9.6.20 landed
- b55b4dad99e9 14.0 landed
- 8d486cfbf249 9.5.24 landed
- 55aea0c706ca 12.5 landed
- 4178b749963c 13.0 landed
- 0c0a3a8591d8 10.15 landed
-
Fix issues around .pgpass file.
- 2eb3bc58814f 13.0 cited