Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2c69d4

Browse files
committed
Fix libpq example programs
When these programs call pg_catalog.set_config, they need to check forPGRES_TUPLES_OK instead of PGRES_COMMAND_OK. Fix for5770172.Reported-by: Ideriha, Takeshi <ideriha.takeshi@jp.fujitsu.com>
1 parentb241c11 commitc2c69d4

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8299,7 +8299,7 @@ main(int argc, char **argv)
82998299
/* Set always-secure search path, so malicous users can't take control. */
83008300
res = PQexec(conn,
83018301
"SELECT pg_catalog.set_config('search_path', '', false)");
8302-
if (PQresultStatus(res) !=PGRES_COMMAND_OK)
8302+
if (PQresultStatus(res) !=PGRES_TUPLES_OK)
83038303
{
83048304
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
83058305
PQclear(res);
@@ -8469,7 +8469,7 @@ main(int argc, char **argv)
84698469
/* Set always-secure search path, so malicous users can't take control. */
84708470
res = PQexec(conn,
84718471
"SELECT pg_catalog.set_config('search_path', '', false)");
8472-
if (PQresultStatus(res) !=PGRES_COMMAND_OK)
8472+
if (PQresultStatus(res) !=PGRES_TUPLES_OK)
84738473
{
84748474
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
84758475
PQclear(res);

‎doc/src/sgml/lobj.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ main(int argc, char **argv)
902902
/* Set always-secure search path, so malicous users can't take control. */
903903
res = PQexec(conn,
904904
"SELECT pg_catalog.set_config('search_path', '', false)");
905-
if (PQresultStatus(res) !=PGRES_COMMAND_OK)
905+
if (PQresultStatus(res) !=PGRES_TUPLES_OK)
906906
{
907907
fprintf(stderr, "SET failed: %s", PQerrorMessage(conn));
908908
PQclear(res);

‎src/test/examples/testlibpq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ main(int argc, char **argv)
5151
/* Set always-secure search path, so malicous users can't take control. */
5252
res=PQexec(conn,
5353
"SELECT pg_catalog.set_config('search_path', '', false)");
54-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
54+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
5555
{
5656
fprintf(stderr,"SET failed: %s",PQerrorMessage(conn));
5757
PQclear(res);

‎src/test/examples/testlibpq2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ main(int argc, char **argv)
8080
/* Set always-secure search path, so malicous users can't take control. */
8181
res=PQexec(conn,
8282
"SELECT pg_catalog.set_config('search_path', '', false)");
83-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
83+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
8484
{
8585
fprintf(stderr,"SET failed: %s",PQerrorMessage(conn));
8686
PQclear(res);

‎src/test/examples/testlibpq4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ check_prepare_conn(PGconn *conn, const char *dbName)
3737
/* Set always-secure search path, so malicous users can't take control. */
3838
res=PQexec(conn,
3939
"SELECT pg_catalog.set_config('search_path', '', false)");
40-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
40+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
4141
{
4242
fprintf(stderr,"SET failed: %s",PQerrorMessage(conn));
4343
PQclear(res);

‎src/test/examples/testlo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ main(int argc, char **argv)
235235
/* Set always-secure search path, so malicous users can't take control. */
236236
res=PQexec(conn,
237237
"SELECT pg_catalog.set_config('search_path', '', false)");
238-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
238+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
239239
{
240240
fprintf(stderr,"SET failed: %s",PQerrorMessage(conn));
241241
PQclear(res);

‎src/test/examples/testlo64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ main(int argc, char **argv)
259259
/* Set always-secure search path, so malicous users can't take control. */
260260
res=PQexec(conn,
261261
"SELECT pg_catalog.set_config('search_path', '', false)");
262-
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
262+
if (PQresultStatus(res)!=PGRES_TUPLES_OK)
263263
{
264264
fprintf(stderr,"SET failed: %s",PQerrorMessage(conn));
265265
PQclear(res);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp