Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: smtpd: require an error message on table-proc failure replies
To:
Omar Polo <op@omarpolo.com>
Cc:
tech@openbsd.org
Date:
Wed, 22 May 2024 19:49:34 +0200

Download raw body.

Thread
On 2024/05/22 19:43:12 +0200, Omar Polo <op@omarpolo.com> wrote:
> in retrospect I should have added a message for the `error' replies
> since the beginning.  To ease the transition don't make it mandatory
> until we fix the external tables and release an update, but document it
> so that it's clear that it is required.

forgot to add, here's a small awk script to test this change.  It'll
return "<operation> failed" for update, check and lookup attempts.  use
it for example like this:

	table pwd "fail"
	action "local_mail" mbox alias <aliases> userbase <passwd>
	# ...


#!/usr/bin/awk -f
# /usr/local/libexec/smtpd/table-fail

BEGIN {
	FS = "|"
	for (i = 0; i < ARGC; i++) ARGV[i] = ""
}

$1 == "config" && $2 == "ready" {
	print "register|alias"
	print "register|userinfo"
	print "register|ready"
	fflush
}

$5 == "update"	{ printf("%s-result|%s|error|%s failed\n", $5, $6, $5) }
$5 == "check"	{ printf("%s-result|%s|error|%s failed\n", $5, $7, $5) }
$5 == "lookup"	{ printf("%s-result|%s|error|%s failed\n", $5, $7, $5) }

// { fflush }