From 20709f813601976076a346c0b0f8e92006e3b3fa Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 26 Oct 2010 21:20:02 -0400 Subject: Add a client authentication hook. KaiGai Kohei, with minor cleanup of the comments by me. --- src/backend/libpq/auth.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/backend/libpq/auth.c') diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index f9685c3a75e..146ebd72114 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -216,6 +216,12 @@ static int CheckRADIUSAuth(Port *port); *---------------------------------------------------------------- */ +/* + * This hook allows plugins to get control following client authentication, + * but before the user has been informed about the results. It could be used + * to record login events, insert a delay after failed authentication, etc. + */ +ClientAuthentication_hook_type ClientAuthentication_hook = NULL; /* * Tell the user the authentication failed, but not (much about) why. @@ -577,6 +583,9 @@ ClientAuthentication(Port *port) break; } + if (ClientAuthentication_hook) + (*ClientAuthentication_hook)(port, status); + if (status == STATUS_OK) sendAuthRequest(port, AUTH_REQ_OK); else -- cgit v1.2.3