Disallow LOAD to non-superusers. Per report from John Heasman.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 24 Jan 2005 17:46:29 +0000 (17:46 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 24 Jan 2005 17:46:29 +0000 (17:46 +0000)
src/backend/tcop/utility.c

index 11fa2fc52d9f71e97de6c12ac42f10ab2bfe2aa3..976a22c8ee13f1aedee1620ee1dd3bdc1e75d32e 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.231 2004/12/31 22:01:16 pgsql Exp $
+ *   $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.231.4.1 2005/01/24 17:46:29 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -803,6 +803,10 @@ ProcessUtility(Node *parsetree,
            {
                LoadStmt   *stmt = (LoadStmt *) parsetree;
 
+               if (!superuser())
+                   ereport(ERROR,
+                           (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+                            errmsg("must be superuser to do LOAD")));
                closeAllVfds(); /* probably not necessary... */
                load_file(stmt->filename);
            }