|
|
|
@ -93,7 +93,7 @@ convert_and_check_filename(text *arg, bool logAllowed) |
|
|
|
|
if (path_contains_parent_reference(filename)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
(errmsg("reference to parent directory (\"..\") not allowed")))); |
|
|
|
|
errmsg("reference to parent directory (\"..\") not allowed"))); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Allow absolute paths if within DataDir or Log_directory, even |
|
|
|
@ -104,12 +104,12 @@ convert_and_check_filename(text *arg, bool logAllowed) |
|
|
|
|
!path_is_prefix_of_path(Log_directory, filename))) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
(errmsg("absolute path not allowed")))); |
|
|
|
|
errmsg("absolute path not allowed"))); |
|
|
|
|
} |
|
|
|
|
else if (!path_is_relative_and_below_cwd(filename)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
(errmsg("path must be in or below the current directory")))); |
|
|
|
|
errmsg("path must be in or below the current directory"))); |
|
|
|
|
|
|
|
|
|
return filename; |
|
|
|
|
} |
|
|
|
@ -124,7 +124,7 @@ requireSuperuser(void) |
|
|
|
|
if (!superuser()) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
(errmsg("only superuser may access generic file functions")))); |
|
|
|
|
errmsg("only superuser may access generic file functions"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -485,7 +485,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS) |
|
|
|
|
if (!superuser()) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), |
|
|
|
|
(errmsg("only superuser can list the log directory")))); |
|
|
|
|
errmsg("only superuser can list the log directory"))); |
|
|
|
|
|
|
|
|
|
return (pg_logdir_ls_internal(fcinfo)); |
|
|
|
|
} |
|
|
|
@ -515,7 +515,7 @@ pg_logdir_ls_internal(FunctionCallInfo fcinfo) |
|
|
|
|
if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'")))); |
|
|
|
|
errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))); |
|
|
|
|
|
|
|
|
|
if (SRF_IS_FIRSTCALL()) |
|
|
|
|
{ |
|
|
|
|