aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/postmaster.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-07-31 22:55:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-07-31 22:55:45 +0000
commit77896d1fc92d3cc48622d24a8fc0037186baeefd (patch)
tree0d3e6698a02f73a06d5fb032c3e063d9dfa39b3f /src/backend/postmaster/postmaster.c
parent0889bd00bd365ca252d75118378171fe5fd48289 (diff)
downloadpostgresql-77896d1fc92d3cc48622d24a8fc0037186baeefd.tar.gz
postgresql-77896d1fc92d3cc48622d24a8fc0037186baeefd.zip
Cleanup code for preparsing pg_hba.conf and pg_ident.conf. Store line
number in the data structure so that we can give at least a minimally useful idea of where the mistake is when we issue syntax error messages. Move the ClientAuthentication() call to where it should have been in the first place, so that postmaster memory releasing can happen in a reasonable place also. Update obsolete comments, correct one real bug (auth_argument was not picked up correctly).
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r--src/backend/postmaster/postmaster.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index c1cd24c7d60..fb51695e98b 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.232 2001/07/30 14:50:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.233 2001/07/31 22:55:45 tgl Exp $
*
* NOTES
*
@@ -805,12 +805,12 @@ ServerLoop(void)
later;
struct timezone tz;
+ load_hba_and_ident();
+
gettimeofday(&now, &tz);
nSockets = initMasks(&readmask, &writemask);
- load_hba_and_ident();
-
for (;;)
{
Port *port;
@@ -876,8 +876,8 @@ ServerLoop(void)
if (got_SIGHUP)
{
got_SIGHUP = false;
- load_hba_and_ident();
ProcessConfigFile(PGC_SIGHUP);
+ load_hba_and_ident();
}
/*
@@ -1902,20 +1902,25 @@ DoBackend(Port *port)
/* Close the postmaster's other sockets */
ClosePostmasterPorts();
- SetProcessingMode(InitProcessing);
-
/* Save port etc. for ps status */
MyProcPort = port;
/* Reset MyProcPid to new backend's pid */
MyProcPid = getpid();
- whereToSendOutput = Remote;
+ whereToSendOutput = Remote; /* XXX probably doesn't belong here */
+ /*
+ * Receive the startup packet (which might turn out to be a cancel
+ * request packet); then perform client authentication.
+ */
status = ProcessStartupPacket(port, false);
+
if (status == 127)
return 0; /* cancel request processed */
+ ClientAuthentication(MyProcPort); /* might not return, if failure */
+
/*
* Don't want backend to be able to see the postmaster random number
* generator state. We have to clobber the static random_seed *and*
@@ -1990,9 +1995,20 @@ DoBackend(Port *port)
av[ac++] = "-o";
av[ac++] = ttybuf;
}
+
av[ac] = (char *) NULL;
/*
+ * Release postmaster's working memory context so that backend can
+ * recycle the space. Note this does not trash *MyProcPort, because
+ * ConnCreate() allocated that space with malloc() ... else we'd need
+ * to copy the Port data here.
+ */
+ MemoryContextSwitchTo(TopMemoryContext);
+ MemoryContextDelete(PostmasterContext);
+ PostmasterContext = NULL;
+
+ /*
* Debug: print arguments being passed to backend
*/
if (DebugLvl > 1)