]> granicus.if.org Git - postgresql/commitdiff
Add configurable option controlling security checks in LO functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 4 Jun 1999 21:13:38 +0000 (21:13 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 4 Jun 1999 21:13:38 +0000 (21:13 +0000)
src/backend/libpq/be-fsstubs.c
src/include/config.h.in

index 135eb03b2da2e08b81a4b4938d8ed687d21bc619..443c2db76dcb38ea4f14c5a1e10b8c7ca7d9882a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.34 1999/05/31 22:53:57 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.35 1999/06/04 21:13:38 tgl Exp $
  *
  * NOTES
  *       This should be moved to a more appropriate place.  It is here
@@ -334,10 +334,12 @@ lo_import(text *filename)
        LargeObjectDesc *lobj;
        Oid                     lobjOid;
 
+#ifndef ALLOW_DANGEROUS_LO_FUNCTIONS
        if (!superuser())
                elog(ERROR, "You must have Postgres superuser privilege to use "
                         "server-side lo_import().\n\tAnyone can use the "
                         "client-side lo_import() provided by libpq.");
+#endif
 
        /*
         * open the file to be read in
@@ -405,10 +407,12 @@ lo_export(Oid lobjId, text *filename)
        LargeObjectDesc *lobj;
        mode_t          oumask;
 
+#ifndef ALLOW_DANGEROUS_LO_FUNCTIONS
        if (!superuser())
                elog(ERROR, "You must have Postgres superuser privilege to use "
                         "server-side lo_export().\n\tAnyone can use the "
                         "client-side lo_export() provided by libpq.");
+#endif
 
        /*
         * open the inversion "object"
index f90501ed11b118874d1223aebc8a59ea100383af..9afb5e251f0c99013ef41dcd332c1f38df2b8426 100644 (file)
@@ -342,7 +342,7 @@ extern void srandom(unsigned int seed);
 #undef USE_POSIX_SIGNALS
 
 /*
- * Code below this point should not require changes
+ * Pull in OS-specific declarations (using link created by configure)
  */
 
 #include "os.h"
@@ -494,6 +494,16 @@ extern void srandom(unsigned int seed);
  */
 /* #define PSQL_ALWAYS_GET_PASSWORDS */
 
+/*
+ * Define this if you want to allow the lo_import and lo_export SQL functions
+ * to be executed by ordinary users.  By default these functions are only
+ * available to the Postgres superuser.  CAUTION: these functions are
+ * SECURITY HOLES since they can read and write any file that the Postgres
+ * backend has permission to access.  If you turn this on, don't say we
+ * didn't warn you.
+ */
+/* #define ALLOW_DANGEROUS_LO_FUNCTIONS */
+
 /*
  * Use btree bulkload code: 
  * this code is moderately slow (~10% slower) compared to the regular