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

Commitced4f8e

Browse files
committed
Merge branch 'master' into rel_future_bounds_cache
2 parents621ce28 +34922aa commitced4f8e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

‎src/hooks.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"xact_handling.h"
2626

2727
#include"access/transam.h"
28+
#include"catalog/pg_authid.h"
2829
#include"miscadmin.h"
2930
#include"optimizer/cost.h"
3031
#include"optimizer/restrictinfo.h"
@@ -567,14 +568,35 @@ pathman_post_parse_analysis_hook(ParseState *pstate, Query *query)
567568
/* Check that pg_pathman is the last extension loaded */
568569
if (post_parse_analyze_hook!=pathman_post_parse_analysis_hook)
569570
{
570-
char*spl_value;/* value of "shared_preload_libraries" GUC */
571+
Oidsave_userid;
572+
intsave_sec_context;
573+
boolneed_priv_escalation= !superuser();/* we might be a SU */
574+
char*spl_value;/* value of "shared_preload_libraries" GUC */
571575

576+
/* Do we have to escalate privileges? */
577+
if (need_priv_escalation)
578+
{
579+
/* Get current user's Oid and security context */
580+
GetUserIdAndSecContext(&save_userid,&save_sec_context);
581+
582+
/* Become superuser in order to bypass sequence ACL checks */
583+
SetUserIdAndSecContext(BOOTSTRAP_SUPERUSERID,
584+
save_sec_context |SECURITY_LOCAL_USERID_CHANGE);
585+
}
586+
587+
/* TODO: add a test for this case (non-privileged user etc) */
588+
589+
/* Only SU can read this GUC */
572590
#ifPG_VERSION_NUM >=90600
573591
spl_value=GetConfigOptionByName("shared_preload_libraries",NULL, false);
574592
#else
575593
spl_value=GetConfigOptionByName("shared_preload_libraries",NULL);
576594
#endif
577595

596+
/* Restore user's privileges */
597+
if (need_priv_escalation)
598+
SetUserIdAndSecContext(save_userid,save_sec_context);
599+
578600
ereport(ERROR,
579601
(errmsg("extension conflict has been detected"),
580602
errdetail("shared_preload_libraries = \"%s\"",spl_value),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp