postgresql/src/backend
Tom Lane 2b65de7fc2 Remove misguided SSL key file ownership check in libpq.
Commits a59c79564 et al. tried to sync libpq's SSL key file
permissions checks with what we've used for years in the backend.
We did not intend to create any new failure cases, but it turns out
we did: restricting the key file's ownership breaks cases where the
client is allowed to read a key file despite not having the identical
UID.  In particular a client running as root used to be able to read
someone else's key file; and having seen that I suspect that there are
other, less-dubious use cases that this restriction breaks on some
platforms.

We don't really need an ownership check, since if we can read the key
file despite its having restricted permissions, it must have the right
ownership --- under normal conditions anyway, and the point of this
patch is that any additional corner cases where that works should be
deemed allowable, as they have been historically.  Hence, just drop
the ownership check, and rearrange the permissions check to get rid
of its faulty assumption that geteuid() can't be zero.  (Note that the
comparable backend-side code doesn't have to cater for geteuid() == 0,
since the server rejects that very early on.)

This does have the end result that the permissions safety check used
for a root user's private key file is weaker than that used for
anyone else's.  While odd, root really ought to know what she's doing
with file permissions, so I think this is acceptable.

Per report from Yogendra Suralkar.  Like the previous patch,
back-patch to all supported branches.

Discussion: https://postgr.es/m/MW3PR15MB3931DF96896DC36D21AFD47CA3D39@MW3PR15MB3931.namprd15.prod.outlook.com
2022-05-26 14:14:05 -04:00
..
access Add 'static' to file-local variables missing it. 2022-05-12 12:39:33 -07:00
bootstrap Indent C code in flex and bison files 2022-05-13 07:17:29 +02:00
catalog Extend pg_publication_tables to display column list and row filter. 2022-05-19 08:20:55 +05:30
commands Fix DDL deparse of CREATE OPERATOR CLASS 2022-05-20 18:52:55 +02:00
executor Avoid overflow hazard when clamping group counts to "long int". 2022-05-21 13:13:44 -04:00
foreign Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
jit Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
lib Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
libpq Remove misguided SSL key file ownership check in libpq. 2022-05-26 14:14:05 -04:00
main Fix collection of typos in the code and the documentation 2022-03-15 11:29:35 +09:00
nodes Rename JsonIsPredicate.value_type, fix JSON backend/nodes/ infrastructure. 2022-05-13 11:40:08 -04:00
optimizer Avoid overflow hazard when clamping group counts to "long int". 2022-05-21 13:13:44 -04:00
parser Check column list length in XMLTABLE/JSON_TABLE alias 2022-05-18 20:28:31 +02:00
partitioning Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
po Translation updates 2022-05-16 11:12:42 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Add a new shmem_request_hook hook. 2022-05-13 09:31:06 -04:00
regex Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
replication Extend pg_publication_tables to display column list and row filter. 2022-05-19 08:20:55 +05:30
rewrite Fix incautious CTE matching in rewriteSearchAndCycle(). 2022-04-23 12:16:12 -04:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
storage Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS 2022-05-19 16:20:32 +02:00
tcop Fix DDL deparse of CREATE OPERATOR CLASS 2022-05-20 18:52:55 +02:00
tsearch Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
utils Avoid ERRCODE_INTERNAL_ERROR in oracle_compat.c functions. 2022-05-26 12:25:10 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00