diff options
author | Noah Misch <noah@leadboat.com> | 2016-08-08 10:07:46 -0400 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2016-08-08 10:07:50 -0400 |
commit | 8adff378308b3500aad45a2d5bfa9ca808f37627 (patch) | |
tree | a657efa6c080f2201329ade789b556e2f79cbd49 /src | |
parent | 2e5e90d8d10ca568381adfaaf53e8a9e8e342375 (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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_dumpall.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 4dfb4a9ebf8..da5ba2645ca 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(const 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 void buildShSecLabels(PGconn *conn, const char *catalog_name, @@ -214,7 +214,7 @@ main(int argc, char *argv[]) case 'f': filename = pg_strdup(optarg); appendPQExpBufferStr(pgdumpopts, " -f "); - doShellQuoting(pgdumpopts, filename); + appendShellString(pgdumpopts, filename); break; case 'g': @@ -251,7 +251,7 @@ main(int argc, char *argv[]) case 'S': appendPQExpBufferStr(pgdumpopts, " -S "); - doShellQuoting(pgdumpopts, optarg); + appendShellString(pgdumpopts, optarg); break; case 't': @@ -287,13 +287,13 @@ main(int argc, char *argv[]) case 2: appendPQExpBufferStr(pgdumpopts, " --lock-wait-timeout "); - doShellQuoting(pgdumpopts, optarg); + appendShellString(pgdumpopts, optarg); break; case 3: use_role = pg_strdup(optarg); appendPQExpBufferStr(pgdumpopts, " --role "); - doShellQuoting(pgdumpopts, use_role); + appendShellString(pgdumpopts, use_role); break; default: @@ -1726,9 +1726,9 @@ runPgDump(const char *dbname) * string. */ appendPQExpBuffer(connstrbuf, "%s dbname=", connstr); - doConnStrQuoting(connstrbuf, dbname); + appendConnStrVal(connstrbuf, dbname); - doShellQuoting(cmd, connstrbuf->data); + appendShellString(cmd, connstrbuf->data); if (verbose) fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data); @@ -2008,7 +2008,7 @@ constructConnStr(const char **keywords, const char **values) appendPQExpBufferChar(buf, ' '); firstkeyword = false; appendPQExpBuffer(buf, "%s=", keywords[i]); - doConnStrQuoting(buf, values[i]); + appendConnStrVal(buf, values[i]); } connstr = pg_strdup(buf->data); @@ -2089,7 +2089,7 @@ dumpTimestamp(const char *msg) * string */ static void -doConnStrQuoting(PQExpBuffer buf, const char *str) +appendConnStrVal(PQExpBuffer buf, const char *str) { const char *s; bool needquotes; @@ -2138,7 +2138,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; |