diff --git i/doc/src/sgml/client-auth.sgml w/doc/src/sgml/client-auth.sgml index 960f5b5..7055d13 100644 --- i/doc/src/sgml/client-auth.sgml +++ w/doc/src/sgml/client-auth.sgml @@ -1612,6 +1612,17 @@ host ... ldap ldapurl="ldap://ldap.example.net/dc=example,dc=net?uid?sub" + + radiustimeout + + + The timeout to wait for a response from the RADIUS server in seconds. + If no value is specified, a default timeout of 3 seconds + will be used. + + + + radiusidentifier diff --git i/src/backend/libpq/auth.c w/src/backend/libpq/auth.c index 0ba8530..8a4e9ab 100644 --- i/src/backend/libpq/auth.c +++ w/src/backend/libpq/auth.c @@ -2379,9 +2379,6 @@ typedef struct /* Maximum size of a RADIUS packet we will create or accept */ #define RADIUS_BUFFER_SIZE 1024 -/* Seconds to wait - XXX: should be in a config variable! */ -#define RADIUS_TIMEOUT 3 - static void radius_add_attribute(radius_packet *packet, uint8 type, const unsigned char *data, int len) { @@ -2463,6 +2460,9 @@ CheckRADIUSAuth(Port *port) if (port->hba->radiusport == 0) port->hba->radiusport = 1812; + if (port->hba->radiustimeout == 0) + port->hba->radiustimeout = 3; + MemSet(&hint, 0, sizeof(hint)); hint.ai_socktype = SOCK_DGRAM; hint.ai_family = AF_UNSPEC; @@ -2626,7 +2626,7 @@ CheckRADIUSAuth(Port *port) * timeouts/cancellations. */ gettimeofday(&endtime, NULL); - endtime.tv_sec += RADIUS_TIMEOUT; + endtime.tv_sec += port->hba->radiustimeout; while (true) { diff --git i/src/backend/libpq/hba.c w/src/backend/libpq/hba.c index f1e9a38..7ef2888 100644 --- i/src/backend/libpq/hba.c +++ w/src/backend/libpq/hba.c @@ -1665,6 +1665,20 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, int line_num) REQUIRE_AUTH_OPTION(uaRADIUS, "radiusidentifier", "radius"); hbaline->radiusidentifier = pstrdup(val); } + else if (strcmp(name, "radiustimeout") == 0) + { + REQUIRE_AUTH_OPTION(uaRADIUS, "radiustimeout", "radius"); + hbaline->radiustimeout = atoi(val); + if (hbaline->radiustimeout == 0) + { + ereport(LOG, + (errcode(ERRCODE_CONFIG_FILE_ERROR), + errmsg("invalid RADIUS timeout value: \"%s\"", val), + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); + return false; + } + } else { ereport(LOG, diff --git i/src/include/libpq/hba.h w/src/include/libpq/hba.h index dc7d257..e206fe9 100644 --- i/src/include/libpq/hba.h +++ w/src/include/libpq/hba.h @@ -85,6 +85,7 @@ typedef struct HbaLine char *radiussecret; char *radiusidentifier; int radiusport; + int radiustimeout; } HbaLine; typedef struct IdentLine