mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Remove the use of the pg_auth flat file for client authentication.
(That flat file is now completely useless, but removal will come later.) To do this, postpone client authentication into the startup transaction that's run by InitPostgres. We still collect the startup packet and do SSL initialization (if needed) at the same time we did before. The AuthenticationTimeout is applied separately to startup packet collection and the actual authentication cycle. (This is a bit annoying, since it means a couple extra syscalls; but the signal handling requirements inside and outside a transaction are sufficiently different that it seems best to treat the timeouts as completely independent.) A small security disadvantage is that if the given database name is invalid, this will be reported to the client before any authentication happens. We could work around that by connecting to database "postgres" instead, but consensus seems to be that it's not worth introducing such surprising behavior. Processing of all command-line switches and GUC options received from the client is now postponed until after authentication. This means that PostAuthDelay is much less useful than it used to be --- if you need to investigate problems during InitPostgres you'll have to set PreAuthDelay instead. However, allowing an unauthenticated user to set any GUC options whatever seems a bit too risky, so we'll live with that.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.511 2009/08/24 20:08:32 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.512 2009/08/29 19:26:51 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -4635,7 +4635,8 @@ set_config_option(const char *name, const char *value,
|
||||
if (IsUnderPostmaster)
|
||||
return true;
|
||||
}
|
||||
else if (context != PGC_BACKEND && context != PGC_POSTMASTER)
|
||||
else if (context != PGC_POSTMASTER && context != PGC_BACKEND &&
|
||||
source != PGC_S_CLIENT)
|
||||
{
|
||||
ereport(elevel,
|
||||
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
|
||||
@ -5243,22 +5244,6 @@ GetConfigOptionResetString(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect whether the given configuration option can only be set by
|
||||
* a superuser.
|
||||
*/
|
||||
bool
|
||||
IsSuperuserConfigOption(const char *name)
|
||||
{
|
||||
struct config_generic *record;
|
||||
|
||||
record = find_option(name, false, ERROR);
|
||||
/* On an unrecognized name, don't error, just return false. */
|
||||
if (record == NULL)
|
||||
return false;
|
||||
return (record->context == PGC_SUSET);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GUC_complaint_elevel
|
||||
|
Reference in New Issue
Block a user