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

Commitd6dbb6b

Browse files
committed
fastpath code neglected to check whether user has privileges to call the
target function. Also, move SetQuerySnapshot() call to avoid assertfailure when a fastpath call is attempted in an aborted transaction.
1 parenta26ac42 commitd6dbb6b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

‎src/backend/tcop/fastpath.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.54 2002/08/24 15:00:46 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.55 2003/01/01 21:57:05 tgl Exp $
1212
*
1313
* NOTES
1414
* This cruft is the server side of PQfn.
@@ -65,8 +65,10 @@
6565
#include"libpq/libpq.h"
6666
#include"libpq/pqformat.h"
6767
#include"tcop/fastpath.h"
68+
#include"utils/acl.h"
6869
#include"utils/lsyscache.h"
6970
#include"utils/syscache.h"
71+
#include"utils/tqual.h"
7072

7173

7274
/* ----------------
@@ -221,6 +223,7 @@ HandleFunctionRequest(void)
221223
intargsize;
222224
intnargs;
223225
inttmp;
226+
AclResultaclresult;
224227
FunctionCallInfoDatafcinfo;
225228
Datumretval;
226229
inti;
@@ -337,6 +340,18 @@ HandleFunctionRequest(void)
337340
elog(ERROR,"current transaction is aborted, "
338341
"queries ignored until end of transaction block");
339342

343+
/* Check permission to call function */
344+
aclresult=pg_proc_aclcheck(fid,GetUserId(),ACL_EXECUTE);
345+
if (aclresult!=ACLCHECK_OK)
346+
aclcheck_error(aclresult,get_func_name(fid));
347+
348+
/*
349+
* Set up a query snapshot in case function needs one. (It is not safe
350+
* to do this if we are in transaction-abort state, so we have to postpone
351+
* it till now. Ugh.)
352+
*/
353+
SetQuerySnapshot();
354+
340355
#ifdefNO_FASTPATH
341356
/* force a NULL return */
342357
retval= (Datum)0;

‎src/backend/tcop/postgres.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.313 2002/12/06 05:00:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.314 2003/01/01 21:57:05 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1781,7 +1781,7 @@ PostgresMain(int argc, char *argv[], const char *username)
17811781
if (!IsUnderPostmaster)
17821782
{
17831783
puts("\nPOSTGRES backend interactive interface ");
1784-
puts("$Revision: 1.313 $ $Date:2002/12/06 05:00:26 $\n");
1784+
puts("$Revision: 1.314 $ $Date:2003/01/01 21:57:05 $\n");
17851785
}
17861786

17871787
/*
@@ -1965,9 +1965,6 @@ PostgresMain(int argc, char *argv[], const char *username)
19651965
/* start an xact for this function invocation */
19661966
start_xact_command();
19671967

1968-
/* assume it may need a snapshot */
1969-
SetQuerySnapshot();
1970-
19711968
if (HandleFunctionRequest()==EOF)
19721969
{
19731970
/* lost frontend connection during F message input */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp