Skip to content

Commit 6d239ee

Browse files
committed
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.
1 parent b824576 commit 6d239ee

File tree

1 file changed

+13
-13
lines changed
  • src/backend/utils/misc

1 file changed

+13
-13
lines changed

src/backend/utils/misc/guc.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.154 2003/09/03 22:05:08 petere Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.155 2003/09/04 05:11:20 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -2556,7 +2556,7 @@ set_config_option(const char *name, const char *value,
25562556
/* Limit non-superuser changes */
25572557
if (record->context == PGC_USERLIMIT &&
25582558
source > PGC_S_UNPRIVILEGED &&
2559-
newval < conf->session_val &&
2559+
newval < conf->reset_val &&
25602560
!superuser())
25612561
{
25622562
ereport(elevel,
@@ -2569,8 +2569,8 @@ set_config_option(const char *name, const char *value,
25692569
/* Allow admin to override non-superuser setting */
25702570
if (record->context == PGC_USERLIMIT &&
25712571
source < PGC_S_UNPRIVILEGED &&
2572-
record->session_source > PGC_S_UNPRIVILEGED &&
2573-
newval > conf->session_val &&
2572+
record->reset_source > PGC_S_UNPRIVILEGED &&
2573+
newval > conf->reset_val &&
25742574
!superuser())
25752575
changeVal = changeVal_orig;
25762576
}
@@ -2652,8 +2652,8 @@ set_config_option(const char *name, const char *value,
26522652
/* Limit non-superuser changes */
26532653
if (record->context == PGC_USERLIMIT &&
26542654
source > PGC_S_UNPRIVILEGED &&
2655-
conf->session_val != 0 &&
2656-
(newval > conf->session_val || newval == 0) &&
2655+
conf->reset_val != 0 &&
2656+
(newval > conf->reset_val || newval == 0) &&
26572657
!superuser())
26582658
{
26592659
ereport(elevel,
@@ -2666,8 +2666,8 @@ set_config_option(const char *name, const char *value,
26662666
/* Allow admin to override non-superuser setting */
26672667
if (record->context == PGC_USERLIMIT &&
26682668
source < PGC_S_UNPRIVILEGED &&
2669-
record->session_source > PGC_S_UNPRIVILEGED &&
2670-
newval < conf->session_val &&
2669+
record->reset_source > PGC_S_UNPRIVILEGED &&
2670+
newval < conf->reset_val &&
26712671
!superuser())
26722672
changeVal = changeVal_orig;
26732673
}
@@ -2749,7 +2749,7 @@ set_config_option(const char *name, const char *value,
27492749
/* Limit non-superuser changes */
27502750
if (record->context == PGC_USERLIMIT &&
27512751
source > PGC_S_UNPRIVILEGED &&
2752-
newval > conf->session_val &&
2752+
newval > conf->reset_val &&
27532753
!superuser())
27542754
{
27552755
ereport(elevel,
@@ -2762,8 +2762,8 @@ set_config_option(const char *name, const char *value,
27622762
/* Allow admin to override non-superuser setting */
27632763
if (record->context == PGC_USERLIMIT &&
27642764
source < PGC_S_UNPRIVILEGED &&
2765-
record->session_source > PGC_S_UNPRIVILEGED &&
2766-
newval < conf->session_val &&
2765+
record->reset_source > PGC_S_UNPRIVILEGED &&
2766+
newval < conf->reset_val &&
27672767
!superuser())
27682768
changeVal = changeVal_orig;
27692769
}
@@ -2860,8 +2860,8 @@ set_config_option(const char *name, const char *value,
28602860
}
28612861
/* Allow admin to override non-superuser setting */
28622862
if (source < PGC_S_UNPRIVILEGED &&
2863-
record->session_source > PGC_S_UNPRIVILEGED &&
2864-
newval < conf->session_val &&
2863+
record->reset_source > PGC_S_UNPRIVILEGED &&
2864+
newval < conf->reset_val &&
28652865
!superuser())
28662866
changeVal = changeVal_orig;
28672867
}

0 commit comments

Comments
 (0)