Stabilize internal relay queue inspection

This commit is contained in:
Mario Fetka
2026-07-24 07:50:58 +02:00
parent 90e30e9992
commit 4ac9cf49ff
2 changed files with 15 additions and 4 deletions
+3 -2
View File
@@ -32,8 +32,9 @@ one-off files in `/tmp`:
configuration without committing a message.
- `smtp-internal-normalization-check.py` sends only to the reserved
`.invalid` namespace through trusted port 26, inspects the real Queue
routing envelope for ten sender-normalization cases, deletes every test
entry, and restores the exact SMTP configuration.
routing envelope for ten sender-normalization cases after atomically moving
each entry to the hold queue, deletes every test entry, and restores the
exact SMTP configuration.
- `c-literal-length-check.py` audits manually sized string literals passed to
Bongo connection I/O helpers and rejects lengths that include a trailing
NUL, truncate a protocol line, or read past the literal.
@@ -239,7 +239,16 @@ def wait_envelope(baseline: set[str], expected_sender: str) -> str:
raise NormalizationCheckError(
f"test created multiple Queue entries: {matches!r}")
if matches:
queue_id = matches[0]
held = queue("hold", matches[0], check=False)
if held.returncode:
time.sleep(0.1)
continue
queue_id = held.stdout.strip()
if not QUEUE_ID.fullmatch(queue_id) or not queue_id.startswith(
"999-"
):
raise NormalizationCheckError(
f"invalid held Queue ID: {queue_id!r}")
envelope = queue("show", queue_id, binary=True).stdout
from_lines = [
line[1:].decode("utf-8", "strict").split()
@@ -347,7 +356,8 @@ def main() -> int:
print(
"SMTP-05 PASS "
f"host={HOST}:{PORT} source={SOURCE} device={DEVICE} cases=10 "
"queue-envelope=yes fcrdns=unit-tested external-boundary=yes "
"queue-envelope=yes queue-held=yes fcrdns=unit-tested "
"external-boundary=yes "
"internet-delivery=no restored=yes"
)
return 0