Re: DOS-style line endings in .pgpass

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vik Fearing <vik(at)2ndquadrant(dot)fr>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: DOS-style line endings in .pgpass
Date: 2016-11-14 20:10:49
Message-ID: 30513.1479154249@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
> On 11/14/2016 08:31 PM, Josh Berkus wrote:
>> What appears to be happening here is that one of the characters of the
>> CRLF is being appended to the password, making it invalid.

> Maybe something like the attached patch?

Our usual approach to \r characters is that they're whitespace. I wonder
whether the most friendly solution here is to chomp all trailing
whitespace. Anybody ever heard of using a trailing space or tab in a
password?

while (len > 0 && strchr(" \t\r\n", buf[len - 1]) != NULL)
buf[--len] = '\0';

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John McKown 2016-11-14 20:19:12 Re: DOS-style line endings in .pgpass
Previous Message John McKown 2016-11-14 20:01:29 Re: DOS-style line endings in .pgpass