From 77896d1fc92d3cc48622d24a8fc0037186baeefd Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 31 Jul 2001 22:55:45 +0000 Subject: 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). --- src/backend/postmaster/postmaster.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/backend/postmaster/postmaster.c') 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,8 +1995,19 @@ 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 */ -- cgit v1.2.3