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

Commit20709f8

Browse files
committed
Add a client authentication hook.
KaiGai Kohei, with minor cleanup of the comments by me.
1 parent1fea0c0 commit20709f8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎src/backend/libpq/auth.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ static intCheckRADIUSAuth(Port *port);
216216
*----------------------------------------------------------------
217217
*/
218218

219+
/*
220+
* This hook allows plugins to get control following client authentication,
221+
* but before the user has been informed about the results. It could be used
222+
* to record login events, insert a delay after failed authentication, etc.
223+
*/
224+
ClientAuthentication_hook_typeClientAuthentication_hook=NULL;
219225

220226
/*
221227
* Tell the user the authentication failed, but not (much about) why.
@@ -577,6 +583,9 @@ ClientAuthentication(Port *port)
577583
break;
578584
}
579585

586+
if (ClientAuthentication_hook)
587+
(*ClientAuthentication_hook)(port,status);
588+
580589
if (status==STATUS_OK)
581590
sendAuthRequest(port,AUTH_REQ_OK);
582591
else

‎src/include/libpq/auth.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ extern char *pg_krb_realm;
2424

2525
externvoidClientAuthentication(Port*port);
2626

27+
/* Hook for plugins to get control in ClientAuthentication() */
28+
typedefvoid (*ClientAuthentication_hook_type)(Port*,int);
29+
externPGDLLIMPORTClientAuthentication_hook_typeClientAuthentication_hook;
30+
2731
#endif/* AUTH_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp