PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
auth_delay.c File Reference
#include "postgres.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.

Functions

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

Variables

 PG_MODULE_MAGIC
 
static int auth_delay_milliseconds
 
static
ClientAuthentication_hook_type 
original_client_auth_hook = NULL
 

Function Documentation

void _PG_init ( void  )

Definition at line 54 of file auth_delay.c.

55 {
56  /* Define custom GUC variables */
57  DefineCustomIntVariable("auth_delay.milliseconds",
58  "Milliseconds to delay before reporting authentication failure",
59  NULL,
61  0,
62  0, INT_MAX / 1000,
63  PGC_SIGHUP,
65  NULL,
66  NULL,
67  NULL);
68  /* Install Hooks */
71 }
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:7713
ClientAuthentication_hook_type ClientAuthentication_hook
Definition: auth.c:226
static ClientAuthentication_hook_type original_client_auth_hook
Definition: auth_delay.c:27
Definition: guc.h:72
static void auth_delay_checks(Port *port, int status)
Definition: auth_delay.c:33
#define NULL
Definition: c.h:226
static int auth_delay_milliseconds
Definition: auth_delay.c:24
#define GUC_UNIT_MS
Definition: guc.h:224
static void auth_delay_checks ( Port port,
int  status 
)
static

Definition at line 33 of file auth_delay.c.

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

Referenced by _PG_init().

34 {
35  /*
36  * Any other plugins which use ClientAuthentication_hook.
37  */
40 
41  /*
42  * Inject a short delay if authentication failed.
43  */
44  if (status != STATUS_OK)
45  {
47  }
48 }
void pg_usleep(long microsec)
Definition: signal.c:53
static ClientAuthentication_hook_type original_client_auth_hook
Definition: auth_delay.c:27
#define STATUS_OK
Definition: c.h:970
static int auth_delay_milliseconds
Definition: auth_delay.c:24
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:222

Variable Documentation

int auth_delay_milliseconds
static

Definition at line 24 of file auth_delay.c.

Referenced by _PG_init(), and auth_delay_checks().

ClientAuthentication_hook_type original_client_auth_hook = NULL
static

Definition at line 27 of file auth_delay.c.

Referenced by _PG_init(), and auth_delay_checks().

PG_MODULE_MAGIC

Definition at line 19 of file auth_delay.c.