Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5e2fc8

Browse files
committed
Modernise pg_hba.conf token processing
The previous coding was ugly, as it marked special tokens as such in thewrong stage, relying on workarounds to figure out if they had beenquoted in the original or not. This made it impossible to have specifickeywords be recognized as such only in certain positions in HBA lines,for example. Fix by restructuring the parser code so that it rememberswhether tokens were quoted or not. This eliminates widespread knowledgeof possible known keywords for all fields.Also improve memory management in this area, to use memory contexts thatare reset as a whole instead of using retail pfrees; this removes awhole lotta crufty (and probably slow) code.Instead of calling strlen() three times in next_field_expand on thereturned token to find out whether there was a comma (and strip it),pass back the info directly from the callee, which is simpler.In passing, update historical artifacts in hba.c API.Authors: Brendan Jurd, Alvaro HerreraReviewed by Pavel Stehule
1 parent615c384 commite5e2fc8

File tree

3 files changed

+656
-620
lines changed

3 files changed

+656
-620
lines changed

‎src/backend/libpq/auth.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,11 @@ ClientAuthentication(Port *port)
315315

316316
/*
317317
* Get the authentication method to use for this frontend/database
318-
* combination. Note:a failure return indicates a problem with the hba
319-
*config file, not with the request. hba.cshould havedropped an error
320-
*messageinto thepostmaster logfile ifit failed.
318+
* combination. Note:we do not parse the file at this point; this has
319+
*already been done elsewhere. hba.c dropped an error message
320+
* into theserver logfile ifparsing the hba config file failed.
321321
*/
322-
if (hba_getauthmethod(port)!=STATUS_OK)
323-
ereport(FATAL,
324-
(errcode(ERRCODE_CONFIG_FILE_ERROR),
325-
errmsg("missing or erroneous pg_hba.conf file"),
326-
errhint("See server log for details.")));
322+
hba_getauthmethod(port);
327323

328324
/*
329325
* Enable immediate response to SIGTERM/SIGINT/timeout interrupts. (We

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp