diff options
| author | Magnus Hagander <magnus@hagander.net> | 2008-09-15 12:32:57 +0000 |
|---|---|---|
| committer | Magnus Hagander <magnus@hagander.net> | 2008-09-15 12:32:57 +0000 |
| commit | 9872381090cf4cd45748422df67f1c64b31c5ead (patch) | |
| tree | 88ea890a635170613f9dcec50170a400c13d310d /src/backend/postmaster/postmaster.c | |
| parent | b850cf61bd5fc4822cf9e73bf28b3261786f6e0b (diff) | |
Parse pg_hba.conf in postmaster, instead of once in each backend for
each connection. This makes it possible to catch errors in the pg_hba
file when it's being reloaded, instead of silently reloading a broken
file and failing only when a user tries to connect.
This patch also makes the "sameuser" argument to ident authentication
optional.
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
| -rw-r--r-- | src/backend/postmaster/postmaster.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 8bc95f1f2f7..72b9387767a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.562 2008/08/25 15:11:01 mha Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.563 2008/09/15 12:32:57 mha Exp $ * * NOTES * @@ -888,7 +888,15 @@ PostmasterMain(int argc, char *argv[]) /* * Load configuration files for client authentication. */ - load_hba(); + if (!load_hba()) + { + /* + * It makes no sense continue if we fail to load the HBA file, since + * there is no way to connect to the database in this case. + */ + ereport(FATAL, + (errmsg("could not load pg_hba.conf"))); + } load_ident(); /* @@ -1927,7 +1935,10 @@ SIGHUP_handler(SIGNAL_ARGS) signal_child(PgStatPID, SIGHUP); /* Reload authentication config files too */ - load_hba(); + if (!load_hba()) + ereport(WARNING, + (errmsg("pg_hba.conf not reloaded"))); + load_ident(); #ifdef EXEC_BACKEND @@ -3081,7 +3092,15 @@ BackendInitialize(Port *port) ALLOCSET_DEFAULT_MAXSIZE); MemoryContextSwitchTo(PostmasterContext); - load_hba(); + if (!load_hba()) + { + /* + * It makes no sense continue if we fail to load the HBA file, since + * there is no way to connect to the database in this case. + */ + ereport(FATAL, + (errmsg("could not load pg_hba.conf"))); + } load_ident(); load_role(); #endif |
