mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
fastpath code neglected to check whether user has privileges to call the
target function. Also, move SetQuerySnapshot() call to avoid assert failure when a fastpath call is attempted in an aborted transaction.
This commit is contained in:
parent
51225120eb
commit
573fe25203
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.54 2002/08/24 15:00:46 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.54.2.1 2003/01/01 21:57:18 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* This cruft is the server side of PQfn.
|
* This cruft is the server side of PQfn.
|
||||||
@ -65,8 +65,10 @@
|
|||||||
#include "libpq/libpq.h"
|
#include "libpq/libpq.h"
|
||||||
#include "libpq/pqformat.h"
|
#include "libpq/pqformat.h"
|
||||||
#include "tcop/fastpath.h"
|
#include "tcop/fastpath.h"
|
||||||
|
#include "utils/acl.h"
|
||||||
#include "utils/lsyscache.h"
|
#include "utils/lsyscache.h"
|
||||||
#include "utils/syscache.h"
|
#include "utils/syscache.h"
|
||||||
|
#include "utils/tqual.h"
|
||||||
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
@ -221,6 +223,7 @@ HandleFunctionRequest(void)
|
|||||||
int argsize;
|
int argsize;
|
||||||
int nargs;
|
int nargs;
|
||||||
int tmp;
|
int tmp;
|
||||||
|
AclResult aclresult;
|
||||||
FunctionCallInfoData fcinfo;
|
FunctionCallInfoData fcinfo;
|
||||||
Datum retval;
|
Datum retval;
|
||||||
int i;
|
int i;
|
||||||
@ -337,6 +340,18 @@ HandleFunctionRequest(void)
|
|||||||
elog(ERROR, "current transaction is aborted, "
|
elog(ERROR, "current transaction is aborted, "
|
||||||
"queries ignored until end of transaction block");
|
"queries ignored until end of transaction block");
|
||||||
|
|
||||||
|
/* Check permission to call function */
|
||||||
|
aclresult = pg_proc_aclcheck(fid, GetUserId(), ACL_EXECUTE);
|
||||||
|
if (aclresult != ACLCHECK_OK)
|
||||||
|
aclcheck_error(aclresult, get_func_name(fid));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set up a query snapshot in case function needs one. (It is not safe
|
||||||
|
* to do this if we are in transaction-abort state, so we have to postpone
|
||||||
|
* it till now. Ugh.)
|
||||||
|
*/
|
||||||
|
SetQuerySnapshot();
|
||||||
|
|
||||||
#ifdef NO_FASTPATH
|
#ifdef NO_FASTPATH
|
||||||
/* force a NULL return */
|
/* force a NULL return */
|
||||||
retval = (Datum) 0;
|
retval = (Datum) 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.307 2002/10/31 21:34:16 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.307.2.1 2003/01/01 21:57:18 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -1781,7 +1781,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.307 $ $Date: 2002/10/31 21:34:16 $\n");
|
puts("$Revision: 1.307.2.1 $ $Date: 2003/01/01 21:57:18 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1965,9 +1965,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
/* start an xact for this function invocation */
|
/* start an xact for this function invocation */
|
||||||
start_xact_command();
|
start_xact_command();
|
||||||
|
|
||||||
/* assume it may need a snapshot */
|
|
||||||
SetQuerySnapshot();
|
|
||||||
|
|
||||||
if (HandleFunctionRequest() == EOF)
|
if (HandleFunctionRequest() == EOF)
|
||||||
{
|
{
|
||||||
/* lost frontend connection during F message input */
|
/* lost frontend connection during F message input */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user