mirror of https://github.com/citusdata/citus.git
Check for absolute paths in COPY with format transmit
parent
118fd6c504
commit
ee9e064eef
|
@ -480,6 +480,8 @@ IsTransmitStmt(Node *parsetree)
|
|||
static void
|
||||
VerifyTransmitStmt(CopyStmt *copyStatement)
|
||||
{
|
||||
char *fileName = NULL;
|
||||
|
||||
/* do some minimal option verification */
|
||||
if (copyStatement->relation == NULL ||
|
||||
copyStatement->relation->relname == NULL)
|
||||
|
@ -488,6 +490,20 @@ VerifyTransmitStmt(CopyStmt *copyStatement)
|
|||
errmsg("FORMAT 'transmit' requires a target file")));
|
||||
}
|
||||
|
||||
fileName = copyStatement->relation->relname;
|
||||
|
||||
if (is_absolute_path(fileName))
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
(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"))));
|
||||
}
|
||||
|
||||
if (copyStatement->filename != NULL)
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
|
|
Loading…
Reference in New Issue