Re: contrib: auth_delay module

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: KaiGai Kohei <kaigai@ak.jp.nec.com>
Cc: Robert Haas <robertmhaas@gmail.com>, "Ross J. Reedstrom" <reedstrm@rice.edu>, Stephen Frost <sfrost@snowman.net>, Jan Urbański <wulczer@wulczer.org>, Itagaki Takahiro <itagaki.takahiro@gmail.com>, KaiGai Kohei <kaigai@kaigai.gr.jp>, PostgreSQL-Hackers <pgsql-hackers@postgresql.org>
Date: 2010-11-26T02:35:47Z
Lists: pgsql-hackers
On Thu, Nov 25, 2010 at 3:18 PM, KaiGai Kohei <kaigai@ak.jp.nec.com> wrote:
> The attached patch is revised version.
>
> - Logging part within auth_delay was removed. This module now focuses on
>  injection of a few seconds delay on authentication failed.
> - Documentation parts were added like any other contrib modules.

Something like the following is not required? Though I'm not sure
if there is the case where auth_delay is unload.

----------------------------
void
_PG_fini(void)
{
	/* Uninstall hooks. */
        ClientAuthentication_hook = original_client_auth_hook;
}
----------------------------

+	if (status != STATUS_OK)
+	{
+		sleep(auth_delay_seconds);
+	}

We should use pg_usleep rather than sleep?

+	DefineCustomIntVariable("auth_delay.seconds",
+							"Seconds to be delayed on authentication failed",
+							NULL,
+							&auth_delay_seconds,
+							2,
+							0, INT_MAX,
+							PGC_POSTMASTER,
+							GUC_UNIT_S,
+							NULL,
+							NULL);

Can we relax the context from PGC_POSTMASTER to PGC_SIGHUP?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center