From e01d38eac7b5dd54b5e03d90fb78bc66f88f49d7 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 19 Sep 2017 16:02:26 +0900 Subject: [PATCH 1/3] Remove ALLOW_DANGEROUS_LO_FUNCTIONS for LO-related superuser checks This switch dated of 4cd4a54c, which is old and not being used anymore by modern distrubutions bundling PostgreSQL. --- src/backend/libpq/be-fsstubs.c | 4 ---- src/include/pg_config_manual.h | 10 ---------- 2 files changed, 14 deletions(-) diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index bf45461b2f..4d75c60979 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -448,13 +448,11 @@ lo_import_internal(text *filename, Oid lobjOid) LargeObjectDesc *lobj; Oid oid; -#ifndef ALLOW_DANGEROUS_LO_FUNCTIONS if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to use server-side lo_import()"), errhint("Anyone can use the client-side lo_import() provided by libpq."))); -#endif CreateFSContext(); @@ -514,13 +512,11 @@ be_lo_export(PG_FUNCTION_ARGS) LargeObjectDesc *lobj; mode_t oumask; -#ifndef ALLOW_DANGEROUS_LO_FUNCTIONS if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to use server-side lo_export()"), errhint("Anyone can use the client-side lo_export() provided by libpq."))); -#endif CreateFSContext(); diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index f3b35297d1..529a554e57 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -66,16 +66,6 @@ */ #define NUM_ATOMICS_SEMAPHORES 64 -/* - * 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 PostgreSQL server has permission to access. If - * you turn this on, don't say we didn't warn you. - */ -/* #define ALLOW_DANGEROUS_LO_FUNCTIONS */ - /* * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence, * maximum usable pathname length is one less). -- 2.14.1