pgpass_crlf.patch

invalid/octet-stream

Filename: pgpass_crlf.patch
Type: invalid/octet-stream
Part: 0
Message: Re: DOS-style line endings in .pgpass

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/interfaces/libpq/fe-connect.c 7 2
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index b4f9ad7..4bd30f1 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -6029,9 +6029,14 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
 		if (len == 0)
 			continue;
 
-		/* Remove trailing newline */
+		/* Remove trailing newline, including msdos-style */
 		if (buf[len - 1] == '\n')
-			buf[len - 1] = 0;
+		{
+			if (len > 1 && buf[len - 2] == '\r')
+				buf[len - 2] = 0;
+			else
+				buf[len - 1] = 0;
+		}
 
 		if ((t = pwdfMatchesString(t, hostname)) == NULL ||
 			(t = pwdfMatchesString(t, port)) == NULL ||