Skip to content

Commit 8adff37

Browse files
committed
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
1 parent 2e5e90d commit 8adff37

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/bin/pg_dump/pg_dumpall.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ static void makeAlterConfigCommand(PGconn *conn, const char *arrayitem,
4949
const char *name2);
5050
static void dumpDatabases(PGconn *conn);
5151
static void dumpTimestamp(const char *msg);
52-
static void doShellQuoting(PQExpBuffer buf, const char *str);
53-
static void doConnStrQuoting(PQExpBuffer buf, const char *str);
52+
static void appendShellString(PQExpBuffer buf, const char *str);
53+
static void appendConnStrVal(PQExpBuffer buf, const char *str);
5454

5555
static int runPgDump(const char *dbname);
5656
static void buildShSecLabels(PGconn *conn, const char *catalog_name,
@@ -214,7 +214,7 @@ main(int argc, char *argv[])
214214
case 'f':
215215
filename = pg_strdup(optarg);
216216
appendPQExpBufferStr(pgdumpopts, " -f ");
217-
doShellQuoting(pgdumpopts, filename);
217+
appendShellString(pgdumpopts, filename);
218218
break;
219219

220220
case 'g':
@@ -251,7 +251,7 @@ main(int argc, char *argv[])
251251

252252
case 'S':
253253
appendPQExpBufferStr(pgdumpopts, " -S ");
254-
doShellQuoting(pgdumpopts, optarg);
254+
appendShellString(pgdumpopts, optarg);
255255
break;
256256

257257
case 't':
@@ -287,13 +287,13 @@ main(int argc, char *argv[])
287287

288288
case 2:
289289
appendPQExpBufferStr(pgdumpopts, " --lock-wait-timeout ");
290-
doShellQuoting(pgdumpopts, optarg);
290+
appendShellString(pgdumpopts, optarg);
291291
break;
292292

293293
case 3:
294294
use_role = pg_strdup(optarg);
295295
appendPQExpBufferStr(pgdumpopts, " --role ");
296-
doShellQuoting(pgdumpopts, use_role);
296+
appendShellString(pgdumpopts, use_role);
297297
break;
298298

299299
default:
@@ -1726,9 +1726,9 @@ runPgDump(const char *dbname)
17261726
* string.
17271727
*/
17281728
appendPQExpBuffer(connstrbuf, "%s dbname=", connstr);
1729-
doConnStrQuoting(connstrbuf, dbname);
1729+
appendConnStrVal(connstrbuf, dbname);
17301730

1731-
doShellQuoting(cmd, connstrbuf->data);
1731+
appendShellString(cmd, connstrbuf->data);
17321732

17331733
if (verbose)
17341734
fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data);
@@ -2008,7 +2008,7 @@ constructConnStr(const char **keywords, const char **values)
20082008
appendPQExpBufferChar(buf, ' ');
20092009
firstkeyword = false;
20102010
appendPQExpBuffer(buf, "%s=", keywords[i]);
2011-
doConnStrQuoting(buf, values[i]);
2011+
appendConnStrVal(buf, values[i]);
20122012
}
20132013

20142014
connstr = pg_strdup(buf->data);
@@ -2089,7 +2089,7 @@ dumpTimestamp(const char *msg)
20892089
* string
20902090
*/
20912091
static void
2092-
doConnStrQuoting(PQExpBuffer buf, const char *str)
2092+
appendConnStrVal(PQExpBuffer buf, const char *str)
20932093
{
20942094
const char *s;
20952095
bool needquotes;
@@ -2138,7 +2138,7 @@ doConnStrQuoting(PQExpBuffer buf, const char *str)
21382138
* there eventually leads to errors here.
21392139
*/
21402140
static void
2141-
doShellQuoting(PQExpBuffer buf, const char *str)
2141+
appendShellString(PQExpBuffer buf, const char *str)
21422142
{
21432143
const char *p;
21442144

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy