Properly enforce pg_dump -F formation options; only single letter or
full words support, per report from Mark Stosberg.
This commit is contained in:
parent
8f65c02f33
commit
832b6d00e9
@ -12,7 +12,7 @@
|
|||||||
* by PostgreSQL
|
* by PostgreSQL
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.461 2007/03/19 23:38:30 wieck Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.462 2007/03/22 19:42:02 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -476,38 +476,33 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* open the output file */
|
/* open the output file */
|
||||||
switch (format[0])
|
if (strcasecmp(format, "a") == 0 || strcasecmp(format, "append") == 0)
|
||||||
{
|
{
|
||||||
case 'a':
|
/* not documented */
|
||||||
case 'A':
|
plainText = 1;
|
||||||
plainText = 1;
|
g_fout = CreateArchive(filename, archNull, 0, archModeAppend);
|
||||||
g_fout = CreateArchive(filename, archNull, 0, archModeAppend);
|
}
|
||||||
break;
|
else if (strcasecmp(format, "c") == 0 || strcasecmp(format, "custom") == 0)
|
||||||
|
g_fout = CreateArchive(filename, archCustom, compressLevel, archModeWrite);
|
||||||
case 'c':
|
else if (strcasecmp(format, "f") == 0 || strcasecmp(format, "file") == 0)
|
||||||
case 'C':
|
{
|
||||||
g_fout = CreateArchive(filename, archCustom, compressLevel, archModeWrite);
|
/*
|
||||||
break;
|
* Dump files into the current directory; for demonstration only, not
|
||||||
|
* documented.
|
||||||
case 'f':
|
*/
|
||||||
case 'F':
|
g_fout = CreateArchive(filename, archFiles, compressLevel, archModeWrite);
|
||||||
g_fout = CreateArchive(filename, archFiles, compressLevel, archModeWrite);
|
}
|
||||||
break;
|
else if (strcasecmp(format, "p") == 0 || strcasecmp(format, "plain") == 0)
|
||||||
|
{
|
||||||
case 'p':
|
plainText = 1;
|
||||||
case 'P':
|
g_fout = CreateArchive(filename, archNull, 0, archModeWrite);
|
||||||
plainText = 1;
|
}
|
||||||
g_fout = CreateArchive(filename, archNull, 0, archModeWrite);
|
else if (strcasecmp(format, "t") == 0 || strcasecmp(format, "tar") == 0)
|
||||||
break;
|
g_fout = CreateArchive(filename, archTar, compressLevel, archModeWrite);
|
||||||
|
else
|
||||||
case 't':
|
{
|
||||||
case 'T':
|
write_msg(NULL, "invalid output format \"%s\" specified\n", format);
|
||||||
g_fout = CreateArchive(filename, archTar, compressLevel, archModeWrite);
|
exit(1);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
write_msg(NULL, "invalid output format \"%s\" specified\n", format);
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_fout == NULL)
|
if (g_fout == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user