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

Commit1b73d0b

Browse files
committed
Refactor code handling the names of files loaded in hba.c
This has the advantage to limit the presence of the GUC valueshba_file and ident_file to the code paths where these files are loaded,easing the introduction of an upcoming feature aimed at adding inclusionlogic for files and directories in HBA and ident files.Note that this needs the addition of the source file name to HbaLine, inaddition to the line number, which is something needed by the backend intwo places of auth.c (authentication failure details and auth_id logwhen log_connections is enabled).While on it, adjust a log generated on authentication failure to reportthe name of the actual HBA file on which the connection attempt matched,where the line number and the raw line written in the HBA file werealready included. This was previously hardcoded as pg_hba.conf, whichwould be incorrect when a custom value is used at postmaster startup forthe GUC hba_file.Extracted from a larger patch by the same author.Author: Julien RouhaudDiscussion:https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud
1 parent13d53aa commit1b73d0b

File tree

3 files changed

+65
-57
lines changed

3 files changed

+65
-57
lines changed

‎src/backend/libpq/auth.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ auth_failed(Port *port, int status, const char *logdetail)
307307
break;
308308
}
309309

310-
cdetail=psprintf(_("Connection matched pg_hba.conf line %d: \"%s\""),
311-
port->hba->linenumber,port->hba->rawline);
310+
cdetail=psprintf(_("Connection matched %s line %d: \"%s\""),
311+
port->hba->sourcefile,port->hba->linenumber,
312+
port->hba->rawline);
312313
if (logdetail)
313314
logdetail=psprintf("%s\n%s",logdetail,cdetail);
314315
else
@@ -365,7 +366,7 @@ set_authn_id(Port *port, const char *id)
365366
"(%s:%d)",
366367
MyClientConnectionInfo.authn_id,
367368
hba_authname(MyClientConnectionInfo.auth_method),
368-
HbaFileName,port->hba->linenumber));
369+
port->hba->sourcefile,port->hba->linenumber));
369370
}
370371
}
371372

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp