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

Commitb62aa83

Browse files
committed
fmgr_security_definer had better do a PG_TRY to ensure the outer userid
is restored on error exit.
1 parentc8196c8 commitb62aa83

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

‎src/backend/utils/fmgr/fmgr.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.84 2004/09/13 01:44:46 neilc Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.85 2004/10/01 20:39:54 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -794,7 +794,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
794794
{
795795
Datumresult;
796796
FmgrInfo*save_flinfo;
797-
structfmgr_security_definer_cache*fcache;
797+
structfmgr_security_definer_cache*volatilefcache;
798798
AclIdsave_userid;
799799
HeapTupletuple;
800800

@@ -821,14 +821,25 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
821821
fcache=fcinfo->flinfo->fn_extra;
822822

823823
save_flinfo=fcinfo->flinfo;
824-
fcinfo->flinfo=&fcache->flinfo;
825-
826824
save_userid=GetUserId();
827-
SetUserId(fcache->userid);
828-
result=FunctionCallInvoke(fcinfo);
829-
SetUserId(save_userid);
825+
826+
PG_TRY();
827+
{
828+
fcinfo->flinfo=&fcache->flinfo;
829+
SetUserId(fcache->userid);
830+
831+
result=FunctionCallInvoke(fcinfo);
832+
}
833+
PG_CATCH();
834+
{
835+
fcinfo->flinfo=save_flinfo;
836+
SetUserId(save_userid);
837+
PG_RE_THROW();
838+
}
839+
PG_END_TRY();
830840

831841
fcinfo->flinfo=save_flinfo;
842+
SetUserId(save_userid);
832843

833844
returnresult;
834845
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp