pgpool2.git / summary / log / commit / refs
commit 35ad6a9d222619bcfff12489964147f16ffd76e7
Author: Yoshiyuki Asaba <y-asaba at pgfoundry.org>
Date: Fri Feb 08 06:47:52 2008 +0000
PostgreSQL superuser can *only* execute pgpool_recovery and
pgpool_remote_start functions because of security issue.
sql/pgpool-recovery/pgpool-recovery.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sql/pgpool-recovery/pgpool-recovery.c b/sql/pgpool-recovery/pgpool-recovery.c
index b33d8b43c..472a193e8 100644
--- a/sql/pgpool-recovery/pgpool-recovery.c
+++ b/sql/pgpool-recovery/pgpool-recovery.c
@@ -52,6 +52,11 @@ pgpool_recovery(PG_FUNCTION_ARGS)
char *remote_data_directory = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(PG_GETARG_TEXT_P(2))));
+ if (!superuser())
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ (errmsg("must be superuser to use pgpool_recovery function"))));
+
sprintf(recovery_script, "%s/%s %s %s %s",
DataDir, script, DataDir, remote_host,
remote_data_directory);
@@ -76,6 +81,11 @@ pgpool_remote_start(PG_FUNCTION_ARGS)
char *remote_data_directory = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(PG_GETARG_TEXT_P(1))));
+ if (!superuser())
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ (errmsg("must be superuser to use pgpool_remote_start function"))));
+
sprintf(recovery_script, "%s/%s %s %s", DataDir, REMOTE_START_FILE,
remote_host, remote_data_directory);
elog(DEBUG1, "recovery_script: %s", recovery_script);
[parent: ef8f08730f46]