aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-06-06 16:25:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-06-06 16:25:52 +0000
commitf9e42d2522aa5a6e150ff12f2d6a2b891b7691d0 (patch)
tree76fa3f6812a5ae3e4377765434a7d163d5fee4bd /src
parent5218f77c52da316aab6eb62391beda3d98b48ae4 (diff)
downloadpostgresql-f9e42d2522aa5a6e150ff12f2d6a2b891b7691d0.tar.gz
postgresql-f9e42d2522aa5a6e150ff12f2d6a2b891b7691d0.zip
Add defense in assign_session_authorization() against trying to do
catalog lookups when not in a transaction. This prevents bizarre failures if someone tries to set a value for session_authorization in postgresql.conf. Per report from Fernando Nasser.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/variable.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 81aade8feec..572b9ed1066 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.71.2.1 2003/02/01 18:31:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.71.2.2 2003/06/06 16:25:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -551,6 +551,16 @@ assign_session_authorization(const char *value, bool doit, bool interactive)
/* not a saved ID, so look it up */
HeapTuple userTup;
+ if (! IsTransactionState())
+ {
+ /*
+ * Can't do catalog lookups, so fail. The upshot of this is
+ * that session_authorization cannot be set in postgresql.conf,
+ * which seems like a good thing anyway.
+ */
+ return NULL;
+ }
+
userTup = SearchSysCache(SHADOWNAME,
PointerGetDatum(value),
0, 0, 0);