PostgreSQL Source Code  git master
auth_delay.c File Reference
#include "postgres.h"
#include <limits.h>
#include "libpq/auth.h"
#include "port.h"
#include "utils/guc.h"
#include "utils/timestamp.h"
Include dependency graph for auth_delay.c:

Go to the source code of this file.


void _PG_init (void)
static void auth_delay_checks (Port *port, int status)


static int auth_delay_milliseconds
static ClientAuthentication_hook_type original_client_auth_hook = NULL

Function Documentation

◆ _PG_init()

void _PG_init ( void  )

Definition at line 56 of file auth_delay.c.

57 {
58  /* Define custom GUC variables */
59  DefineCustomIntVariable("auth_delay.milliseconds",
60  "Milliseconds to delay before reporting authentication failure",
61  NULL,
63  0,
64  0, INT_MAX / 1000,
67  NULL,
68  NULL,
69  NULL);
71  MarkGUCPrefixReserved("auth_delay");
73  /* Install Hooks */
76 }
ClientAuthentication_hook_type ClientAuthentication_hook
Definition: auth.c:236
static void auth_delay_checks(Port *port, int status)
Definition: auth_delay.c:35
static int auth_delay_milliseconds
Definition: auth_delay.c:26
static ClientAuthentication_hook_type original_client_auth_hook
Definition: auth_delay.c:29
void MarkGUCPrefixReserved(const char *className)
Definition: guc.c:9625
void DefineCustomIntVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, int minValue, int maxValue, GucContext context, int flags, GucIntCheckHook check_hook, GucIntAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:9504
#define GUC_UNIT_MS
Definition: guc.h:228
Definition: guc.h:72

References auth_delay_checks(), auth_delay_milliseconds, ClientAuthentication_hook, DefineCustomIntVariable(), GUC_UNIT_MS, MarkGUCPrefixReserved(), original_client_auth_hook, and PGC_SIGHUP.

◆ auth_delay_checks()

static void auth_delay_checks ( Port port,
int  status 

Definition at line 35 of file auth_delay.c.

36 {
37  /*
38  * Any other plugins which use ClientAuthentication_hook.
39  */
43  /*
44  * Inject a short delay if authentication failed.
45  */
46  if (status != STATUS_OK)
47  {
49  }
50 }
#define STATUS_OK
Definition: c.h:1178
static int port
Definition: pg_regress.c:92
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:229
void pg_usleep(long microsec)
Definition: signal.c:53

References auth_delay_milliseconds, original_client_auth_hook, pg_usleep(), port, status(), and STATUS_OK.

Referenced by _PG_init().

Variable Documentation

◆ auth_delay_milliseconds

int auth_delay_milliseconds

Definition at line 26 of file auth_delay.c.

Referenced by _PG_init(), and auth_delay_checks().

◆ original_client_auth_hook

ClientAuthentication_hook_type original_client_auth_hook = NULL

Definition at line 29 of file auth_delay.c.

Referenced by _PG_init(), and auth_delay_checks().



Definition at line 21 of file auth_delay.c.