Load pg_hba.conf and pg_ident.conf on startup and SIGHUP into List of
Lists, and use that for user validation. Bruce Momjian
This commit is contained in:
parent
8d464d05d7
commit
462b7d46d1
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@ -809,6 +809,8 @@ ServerLoop(void)
|
||||
|
||||
nSockets = initMasks(&readmask, &writemask);
|
||||
|
||||
load_hba_and_ident();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
Port *port;
|
||||
@ -874,6 +876,7 @@ ServerLoop(void)
|
||||
if (got_SIGHUP)
|
||||
{
|
||||
got_SIGHUP = false;
|
||||
load_hba_and_ident();
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
}
|
||||
|
||||
@ -993,7 +996,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
|
||||
buf = palloc(len);
|
||||
pq_getbytes(buf, len);
|
||||
|
||||
|
||||
packet = buf;
|
||||
|
||||
/*
|
||||
@ -1479,7 +1482,7 @@ reaper(SIGNAL_ARGS)
|
||||
#endif
|
||||
/*
|
||||
* Check if this child was the statistics collector. If
|
||||
* so, start a new one.
|
||||
* so, start a new one.
|
||||
*/
|
||||
if (pgstat_ispgstat(pid))
|
||||
{
|
||||
@ -1987,19 +1990,8 @@ 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
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -1120,7 +1120,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
||||
unsigned short remote_port;
|
||||
|
||||
char *potential_DataDir = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Catch standard options before doing much else. This even works on
|
||||
* systems without getopt_long.
|
||||
@ -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 (!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);
|
||||
EnableExceptionHandling(true);
|
||||
MemoryContextInit();
|
||||
}
|
||||
|
||||
if (IsUnderPostmaster)
|
||||
ClientAuthentication(MyProcPort); /* might not return */
|
||||
|
||||
/*
|
||||
* Set default values for command-line options.
|
||||
*/
|
||||
@ -1714,7 +1725,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
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 @@
|
||||
* 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 $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -40,8 +40,9 @@ typedef enum UserAuth
|
||||
|
||||
typedef struct Port hbaPort;
|
||||
|
||||
int hba_getauthmethod(hbaPort *port);
|
||||
int hba_getauthmethod(hbaPort *port);
|
||||
int authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
|
||||
const char *postgres_username, const char *auth_arg);
|
||||
void load_hba_and_ident(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user