summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2016-08-08 10:07:46 -0400
committerNoah Misch <noah@leadboat.com>2016-08-08 10:07:54 -0400
commitd2dd5df5142b1faf2c96ddf5f0c0b358b14f1ac9 (patch)
tree1e0811eaf93bbf206337d8728414742350e31b1e
parentc761c9fee082623777466e6a5841056960fc006c (diff)
Promote pg_dumpall shell/connstr quoting functions to src/fe_utils.
Rename these newly-extern functions with terms more typical of their new neighbors. No functional changes; a subsequent commit will use them in more places. Back-patch to 9.1 (all supported versions). Back branches lack src/fe_utils, so instead rename the functions in place; the subsequent commit will copy them into the other programs using them. Security: CVE-2016-5424
-rw-r--r--src/bin/pg_dump/pg_dumpall.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 76702c68b87..fa186c6c3a1 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -49,8 +49,8 @@ static void makeAlterConfigCommand(PGconn *conn, const char *arrayitem,
const char *name2);
static void dumpDatabases(PGconn *conn);
static void dumpTimestamp(char *msg);
-static void doShellQuoting(PQExpBuffer buf, const char *str);
-static void doConnStrQuoting(PQExpBuffer buf, const char *str);
+static void appendShellString(PQExpBuffer buf, const char *str);
+static void appendConnStrVal(PQExpBuffer buf, const char *str);
static int runPgDump(const char *dbname);
static PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport,
@@ -201,7 +201,7 @@ main(int argc, char *argv[])
case 'f':
filename = optarg;
appendPQExpBuffer(pgdumpopts, " -f ");
- doShellQuoting(pgdumpopts, filename);
+ appendShellString(pgdumpopts, filename);
break;
case 'g':
@@ -211,7 +211,7 @@ main(int argc, char *argv[])
case 'h':
pghost = optarg;
appendPQExpBuffer(pgdumpopts, " -h ");
- doShellQuoting(pgdumpopts, pghost);
+ appendShellString(pgdumpopts, pghost);
break;
case 'i':
@@ -233,7 +233,7 @@ main(int argc, char *argv[])
case 'p':
pgport = optarg;
appendPQExpBuffer(pgdumpopts, " -p ");
- doShellQuoting(pgdumpopts, pgport);
+ appendShellString(pgdumpopts, pgport);
break;
case 'r':
@@ -246,7 +246,7 @@ main(int argc, char *argv[])
case 'S':
appendPQExpBuffer(pgdumpopts, " -S ");
- doShellQuoting(pgdumpopts, optarg);
+ appendShellString(pgdumpopts, optarg);
break;
case 't':
@@ -256,7 +256,7 @@ main(int argc, char *argv[])
case 'U':
pguser = optarg;
appendPQExpBuffer(pgdumpopts, " -U ");
- doShellQuoting(pgdumpopts, pguser);
+ appendShellString(pgdumpopts, pguser);
break;
case 'v':
@@ -284,13 +284,13 @@ main(int argc, char *argv[])
case 2:
appendPQExpBuffer(pgdumpopts, " --lock-wait-timeout ");
- doShellQuoting(pgdumpopts, optarg);
+ appendShellString(pgdumpopts, optarg);
break;
case 3:
use_role = optarg;
appendPQExpBuffer(pgdumpopts, " --role ");
- doShellQuoting(pgdumpopts, use_role);
+ appendShellString(pgdumpopts, use_role);
break;
default:
@@ -1643,9 +1643,9 @@ runPgDump(const char *dbname)
* incorrectly treat it as a connection string.
*/
appendPQExpBufferStr(connstrbuf, "dbname=");
- doConnStrQuoting(connstrbuf, dbname);
+ appendConnStrVal(connstrbuf, dbname);
- doShellQuoting(cmd, connstrbuf->data);
+ appendShellString(cmd, connstrbuf->data);
appendPQExpBuffer(cmd, "%s", SYSTEMQUOTE);
@@ -1888,7 +1888,7 @@ dumpTimestamp(char *msg)
* string
*/
static void
-doConnStrQuoting(PQExpBuffer buf, const char *str)
+appendConnStrVal(PQExpBuffer buf, const char *str)
{
const char *s;
bool needquotes;
@@ -1937,7 +1937,7 @@ doConnStrQuoting(PQExpBuffer buf, const char *str)
* there eventually leads to errors here.
*/
static void
-doShellQuoting(PQExpBuffer buf, const char *str)
+appendShellString(PQExpBuffer buf, const char *str)
{
const char *p;