Commit 462b7d46 authored by Bruce Momjian's avatar Bruce Momjian

Load pg_hba.conf and pg_ident.conf on startup and SIGHUP into List of

Lists, and use that for user validation.

Bruce Momjian
parent 8d464d05
This diff is collapsed.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.231 2001/07/03 16:52:12 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.232 2001/07/30 14:50:22 momjian Exp $
* *
* NOTES * NOTES
* *
...@@ -809,6 +809,8 @@ ServerLoop(void) ...@@ -809,6 +809,8 @@ ServerLoop(void)
nSockets = initMasks(&readmask, &writemask); nSockets = initMasks(&readmask, &writemask);
load_hba_and_ident();
for (;;) for (;;)
{ {
Port *port; Port *port;
...@@ -874,6 +876,7 @@ ServerLoop(void) ...@@ -874,6 +876,7 @@ ServerLoop(void)
if (got_SIGHUP) if (got_SIGHUP)
{ {
got_SIGHUP = false; got_SIGHUP = false;
load_hba_and_ident();
ProcessConfigFile(PGC_SIGHUP); ProcessConfigFile(PGC_SIGHUP);
} }
...@@ -1987,19 +1990,8 @@ DoBackend(Port *port) ...@@ -1987,19 +1990,8 @@ DoBackend(Port *port)
av[ac++] = "-o"; av[ac++] = "-o";
av[ac++] = ttybuf; av[ac++] = ttybuf;
} }
av[ac] = (char *) NULL; 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 * Debug: print arguments being passed to backend
*/ */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.227 2001/06/29 16:05:56 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.228 2001/07/30 14:50:24 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1144,16 +1144,27 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1144,16 +1144,27 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
* *
* If we are running under the postmaster, this is done already. * If we are running under the postmaster, this is done already.
*/ */
if (!IsUnderPostmaster) if (IsUnderPostmaster)
{
MemoryContextSwitchTo(TopMemoryContext);
ClientAuthentication(MyProcPort); /* might not return */
/*
* 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. We delete it here because the
* authorization file tokens are stored in this context.
*/
MemoryContextDelete(PostmasterContext);
PostmasterContext = NULL;
}
else
{ {
SetProcessingMode(InitProcessing); SetProcessingMode(InitProcessing);
EnableExceptionHandling(true); EnableExceptionHandling(true);
MemoryContextInit(); MemoryContextInit();
} }
if (IsUnderPostmaster)
ClientAuthentication(MyProcPort); /* might not return */
/* /*
* Set default values for command-line options. * Set default values for command-line options.
*/ */
...@@ -1714,7 +1725,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1714,7 +1725,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.227 $ $Date: 2001/06/29 16:05:56 $\n"); puts("$Revision: 1.228 $ $Date: 2001/07/30 14:50:24 $\n");
} }
/* /*
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Interface to hba.c * Interface to hba.c
* *
* *
* $Id: hba.h,v 1.19 2001/03/22 04:00:47 momjian Exp $ * $Id: hba.h,v 1.20 2001/07/30 14:50:24 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -43,5 +43,6 @@ typedef struct Port hbaPort; ...@@ -43,5 +43,6 @@ typedef struct Port hbaPort;
int hba_getauthmethod(hbaPort *port); int hba_getauthmethod(hbaPort *port);
int authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr, int authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
const char *postgres_username, const char *auth_arg); const char *postgres_username, const char *auth_arg);
void load_hba_and_ident(void);
#endif #endif
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