Commit 4467194b authored by Tom Lane's avatar Tom Lane

Reduce proc_exit(1) to proc_exit(0) for errors detected in backend

command line processing.  As it stood, a bogus PGOPTIONS value from
a client would force a database system restart.  Not bad as a denial-
of-service attack...
parent e79b2dd5
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.143 2000/02/19 22:10:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.144 2000/02/20 04:26:35 tgl Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1256,7 +1256,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1256,7 +1256,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
(ShowParserStats || ShowPlannerStats || ShowExecutorStats)) (ShowParserStats || ShowPlannerStats || ShowExecutorStats))
{ {
fprintf(stderr, "-s can not be used together with -t.\n"); fprintf(stderr, "-s can not be used together with -t.\n");
proc_exit(1); proc_exit(0);
} }
if (!DataDir) if (!DataDir)
...@@ -1264,7 +1264,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1264,7 +1264,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
fprintf(stderr, "%s does not know where to find the database system " fprintf(stderr, "%s does not know where to find the database system "
"data. You must specify the directory that contains the " "data. You must specify the directory that contains the "
"database system either by specifying the -D invocation " "database system either by specifying the -D invocation "
"option or by setting the PGDATA environment variable.\n\n", "option or by setting the PGDATA environment variable.\n\n",
argv[0]); argv[0]);
proc_exit(1); proc_exit(1);
} }
...@@ -1324,7 +1324,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1324,7 +1324,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (errs || argc != optind || DBName == NULL) if (errs || argc != optind || DBName == NULL)
{ {
usage(argv[0]); usage(argv[0]);
proc_exit(1); proc_exit(0);
} }
pq_init(); /* initialize libpq at backend startup */ pq_init(); /* initialize libpq at backend startup */
whereToSendOutput = Remote; whereToSendOutput = Remote;
...@@ -1337,7 +1337,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1337,7 +1337,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (errs || argc - optind > 1) if (errs || argc - optind > 1)
{ {
usage(argv[0]); usage(argv[0]);
proc_exit(1); proc_exit(0);
} }
else if (argc - optind == 1) else if (argc - optind == 1)
DBName = argv[optind]; DBName = argv[optind];
...@@ -1345,7 +1345,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1345,7 +1345,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
{ {
fprintf(stderr, "%s: USER undefined and no database specified\n", fprintf(stderr, "%s: USER undefined and no database specified\n",
argv[0]); argv[0]);
proc_exit(1); proc_exit(0);
} }
/* /*
...@@ -1503,14 +1503,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1503,14 +1503,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.143 $ $Date: 2000/02/19 22:10:47 $\n"); puts("$Revision: 1.144 $ $Date: 2000/02/20 04:26:35 $\n");
} }
/* /*
* Initialize the deferred trigger manager * Initialize the deferred trigger manager
*/ */
if (DeferredTriggerInit() != 0) if (DeferredTriggerInit() != 0)
proc_exit(1); proc_exit(0);
SetProcessingMode(NormalProcessing); SetProcessingMode(NormalProcessing);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment