Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f12abb

Browse files
committed
Push superuser check farther down in the if() statements to fix startup
crash with debug in log_statement patch.
1 parent0bb21d3 commit1f12abb

File tree

1 file changed

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

1 file changed

+17
-17
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 17 additions & 17 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-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.198 2004/04/0705:05:50 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.199 2004/04/0718:52:26 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -2730,13 +2730,12 @@ set_config_option(const char *name, const char *value,
27302730
name)));
27312731
return false;
27322732
}
2733-
if (record->context==PGC_USERLIMIT&&
2734-
IsUnderPostmaster&& !superuser())
2733+
if (record->context==PGC_USERLIMIT)
27352734
{
27362735
if (newval<conf->reset_val)
27372736
{
27382737
/* Limit non-superuser changes */
2739-
if (source>PGC_S_UNPRIVILEGED)
2738+
if (source>PGC_S_UNPRIVILEGED&& !superuser())
27402739
{
27412740
ereport(elevel,
27422741
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -2750,7 +2749,8 @@ set_config_option(const char *name, const char *value,
27502749
{
27512750
/* Allow change if admin should override */
27522751
if (source<PGC_S_UNPRIVILEGED&&
2753-
record->source>PGC_S_UNPRIVILEGED)
2752+
record->source>PGC_S_UNPRIVILEGED&&
2753+
!superuser())
27542754
changeVal=changeValOrig;
27552755
}
27562756
}
@@ -2830,16 +2830,15 @@ set_config_option(const char *name, const char *value,
28302830
newval,name,conf->min,conf->max)));
28312831
return false;
28322832
}
2833-
if (record->context==PGC_USERLIMIT&&
2834-
IsUnderPostmaster&& !superuser())
2833+
if (record->context==PGC_USERLIMIT)
28352834
{
28362835
/* handle log_min_duration_statement, -1=disable */
28372836
if ((newval!=-1&&conf->reset_val!=-1&&
28382837
newval>conf->reset_val)||/* increase duration */
28392838
(newval==-1&&conf->reset_val!=-1))/* turn off */
28402839
{
28412840
/* Limit non-superuser changes */
2842-
if (source>PGC_S_UNPRIVILEGED)
2841+
if (source>PGC_S_UNPRIVILEGED&& !superuser())
28432842
{
28442843
ereport(elevel,
28452844
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -2855,7 +2854,8 @@ set_config_option(const char *name, const char *value,
28552854
(newval!=-1&&*conf->variable==-1))/* turn on */
28562855
{
28572856
if (source<PGC_S_UNPRIVILEGED&&
2858-
record->source>PGC_S_UNPRIVILEGED)
2857+
record->source>PGC_S_UNPRIVILEGED&&
2858+
!superuser())
28592859
changeVal=changeValOrig;
28602860
}
28612861
}
@@ -2935,12 +2935,11 @@ set_config_option(const char *name, const char *value,
29352935
newval,name,conf->min,conf->max)));
29362936
return false;
29372937
}
2938-
if (record->context==PGC_USERLIMIT&&
2939-
IsUnderPostmaster&& !superuser())
2938+
if (record->context==PGC_USERLIMIT)
29402939
/* No REAL PGC_USERLIMIT */
29412940
{
29422941
/* Limit non-superuser changes */
2943-
if (source>PGC_S_UNPRIVILEGED)
2942+
if (source>PGC_S_UNPRIVILEGED&& !superuser())
29442943
{
29452944
ereport(elevel,
29462945
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -2951,7 +2950,8 @@ set_config_option(const char *name, const char *value,
29512950
}
29522951
/* Allow change if admin should override */
29532952
if (source<PGC_S_UNPRIVILEGED&&
2954-
record->source>PGC_S_UNPRIVILEGED)
2953+
record->source>PGC_S_UNPRIVILEGED&&
2954+
!superuser())
29552955
changeVal= false;
29562956
}
29572957
}
@@ -3023,8 +3023,7 @@ set_config_option(const char *name, const char *value,
30233023
return false;
30243024
}
30253025

3026-
if (record->context==PGC_USERLIMIT&&
3027-
IsUnderPostmaster&& !superuser())
3026+
if (record->context==PGC_USERLIMIT)
30283027
{
30293028
intvar_value,reset_value,new_value;
30303029
constchar* (*var_hook) (int*var,constchar*newval,
@@ -3045,7 +3044,7 @@ set_config_option(const char *name, const char *value,
30453044
if (new_value>reset_value)
30463045
{
30473046
/* Limit non-superuser changes */
3048-
if (source>PGC_S_UNPRIVILEGED)
3047+
if (source>PGC_S_UNPRIVILEGED&& !superuser())
30493048
{
30503049
ereport(elevel,
30513050
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -3060,7 +3059,8 @@ set_config_option(const char *name, const char *value,
30603059
if (new_value<var_value)
30613060
{
30623061
if (source<PGC_S_UNPRIVILEGED&&
3063-
record->source>PGC_S_UNPRIVILEGED)
3062+
record->source>PGC_S_UNPRIVILEGED&&
3063+
!superuser())
30643064
changeVal=changeValOrig;
30653065
}
30663066
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp