From a84e46bf39c7fe59e6f24eca11224a2ec91ed518 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 4 Sep 2003 05:11:20 +0000 Subject: [PATCH] Allow non-super users to set log_duration to true, then false, when the administrator has not turned it on, and fix other PGC_USERLIMIT variables. --- src/backend/utils/misc/guc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 17accec194..841846ba79 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -2556,7 +2556,7 @@ set_config_option(const char *name, const char *value, /* Limit non-superuser changes */ if (record->context == PGC_USERLIMIT && source > PGC_S_UNPRIVILEGED && - newval < conf->session_val && + newval < conf->reset_val && !superuser()) { ereport(elevel, @@ -2569,8 +2569,8 @@ set_config_option(const char *name, const char *value, /* Allow admin to override non-superuser setting */ if (record->context == PGC_USERLIMIT && source < PGC_S_UNPRIVILEGED && - record->session_source > PGC_S_UNPRIVILEGED && - newval > conf->session_val && + record->reset_source > PGC_S_UNPRIVILEGED && + newval > conf->reset_val && !superuser()) changeVal = changeVal_orig; } @@ -2652,8 +2652,8 @@ set_config_option(const char *name, const char *value, /* Limit non-superuser changes */ if (record->context == PGC_USERLIMIT && source > PGC_S_UNPRIVILEGED && - conf->session_val != 0 && - (newval > conf->session_val || newval == 0) && + conf->reset_val != 0 && + (newval > conf->reset_val || newval == 0) && !superuser()) { ereport(elevel, @@ -2666,8 +2666,8 @@ set_config_option(const char *name, const char *value, /* Allow admin to override non-superuser setting */ if (record->context == PGC_USERLIMIT && source < PGC_S_UNPRIVILEGED && - record->session_source > PGC_S_UNPRIVILEGED && - newval < conf->session_val && + record->reset_source > PGC_S_UNPRIVILEGED && + newval < conf->reset_val && !superuser()) changeVal = changeVal_orig; } @@ -2749,7 +2749,7 @@ set_config_option(const char *name, const char *value, /* Limit non-superuser changes */ if (record->context == PGC_USERLIMIT && source > PGC_S_UNPRIVILEGED && - newval > conf->session_val && + newval > conf->reset_val && !superuser()) { ereport(elevel, @@ -2762,8 +2762,8 @@ set_config_option(const char *name, const char *value, /* Allow admin to override non-superuser setting */ if (record->context == PGC_USERLIMIT && source < PGC_S_UNPRIVILEGED && - record->session_source > PGC_S_UNPRIVILEGED && - newval < conf->session_val && + record->reset_source > PGC_S_UNPRIVILEGED && + newval < conf->reset_val && !superuser()) changeVal = changeVal_orig; } @@ -2860,8 +2860,8 @@ set_config_option(const char *name, const char *value, } /* Allow admin to override non-superuser setting */ if (source < PGC_S_UNPRIVILEGED && - record->session_source > PGC_S_UNPRIVILEGED && - newval < conf->session_val && + record->reset_source > PGC_S_UNPRIVILEGED && + newval < conf->reset_val && !superuser()) changeVal = changeVal_orig; } -- 2.39.5