Hi all,
I realize needing this might be unusual, but others may benefit.
Christophe
diff -ru postfix-3.10.4/src/postqueue/postqueue.c postfix-3.10.4+postqueue/src/postqueue/postqueue.c
--- postfix-3.10.4/src/postqueue/postqueue.c 2023-12-03 19:11:58.000000000 -0500
+++ postfix-3.10.4+postqueue/src/postqueue/postqueue.c 2025-10-24 18:05:45.432387732 -0400
@@ -131,6 +131,8 @@
/* .RS
/* .IP \fBaddress\fR
/* One recipient address.
+/* .IP \forig_Baddress\fR
+/* One original recipient address.
/* .IP \fBdelay_reason\fR
/* If present, the reason for delayed delivery. Delayed
/* recipients may have no delay reason, for example, while
diff -ru postfix-3.10.4/src/postqueue/showq_compat.c postfix-3.10.4+postqueue/src/postqueue/showq_compat.c
--- postfix-3.10.4/src/postqueue/showq_compat.c 2023-12-03 19:11:58.000000000 -0500
+++ postfix-3.10.4+postqueue/src/postqueue/showq_compat.c 2025-10-24 17:59:32.953462471 -0400
@@ -84,6 +84,7 @@
static VSTRING *queue_name = 0;
static VSTRING *queue_id = 0;
static VSTRING *id_status = 0;
+ static VSTRING *oaddr = 0;
static VSTRING *addr = 0;
static VSTRING *why = 0;
long arrival_time;
@@ -102,6 +103,7 @@
queue_name = vstring_alloc(100);
queue_id = vstring_alloc(100);
id_status = vstring_alloc(100);
+ oaddr = vstring_alloc(100);
addr = vstring_alloc(100);
why = vstring_alloc(100);
}
@@ -146,9 +148,10 @@
while ((showq_status = attr_scan_more(showq_stream)) > 0) {
if (attr_scan(showq_stream, ATTR_FLAG_MORE | ATTR_FLAG_STRICT
| ATTR_FLAG_PRINTABLE,
+ RECV_ATTR_STR(MAIL_ATTR_ORCPT, oaddr),
RECV_ATTR_STR(MAIL_ATTR_RECIP, addr),
RECV_ATTR_STR(MAIL_ATTR_WHY, why),
- ATTR_TYPE_END) != 2)
+ ATTR_TYPE_END) != 3)
msg_fatal_status(EX_SOFTWARE, "malformed showq server response");
/*
diff -ru postfix-3.10.4/src/postqueue/showq_json.c postfix-3.10.4+postqueue/src/postqueue/showq_json.c
--- postfix-3.10.4/src/postqueue/showq_json.c 2023-12-07 20:34:50.000000000 -0500
+++ postfix-3.10.4+postqueue/src/postqueue/showq_json.c 2025-10-24 17:20:57.723459276 -0400
@@ -64,6 +64,7 @@
{
static VSTRING *queue_name = 0;
static VSTRING *queue_id = 0;
+ static VSTRING *oaddr = 0;
static VSTRING *addr = 0;
static VSTRING *why = 0;
static VSTRING *quote_buf = 0;
@@ -79,6 +80,7 @@
if (queue_name == 0) {
queue_name = vstring_alloc(100);
queue_id = vstring_alloc(100);
+ oaddr = vstring_alloc(100);
addr = vstring_alloc(100);
why = vstring_alloc(100);
quote_buf = vstring_alloc(100);
@@ -126,10 +128,14 @@
vstream_printf("{");
if (attr_scan(showq_stream, ATTR_FLAG_MORE | ATTR_FLAG_STRICT
| ATTR_FLAG_PRINTABLE,
+ RECV_ATTR_STR(MAIL_ATTR_ORCPT, oaddr),
RECV_ATTR_STR(MAIL_ATTR_RECIP, addr),
RECV_ATTR_STR(MAIL_ATTR_WHY, why),
- ATTR_TYPE_END) != 2)
+ ATTR_TYPE_END) != 3)
msg_fatal_status(EX_SOFTWARE, "malformed showq server response");
+ if (LEN(oaddr) > 0)
+ vstream_printf("\"orig_address\": \"%s\", ",
+ QUOTE_JSON(quote_buf, STR(oaddr)));
vstream_printf("\"address\": \"%s\"",
QUOTE_JSON(quote_buf, STR(addr)));
if (LEN(why) > 0)
diff -ru postfix-3.10.4/src/showq/showq.c postfix-3.10.4+postqueue/src/showq/showq.c
--- postfix-3.10.4/src/showq/showq.c 2022-02-20 17:27:31.000000000 -0500
+++ postfix-3.10.4+postqueue/src/showq/showq.c 2025-10-24 17:53:12.246176147 -0400
@@ -171,6 +171,7 @@
long msg_size = size;
BOUNCE_LOG *logfile;
HTABLE *dup_filter = 0;
+ VSTRING *orcpt_buf = vstring_alloc(100);
RCPT_BUF *rcpt_buf = 0;
DSN_BUF *dsn_buf = 0;
int sender_seen = 0;
@@ -184,6 +185,7 @@
attr_print(client, ATTR_FLAG_NONE, ATTR_TYPE_END); \
vstring_free(buf); \
vstring_free(printable_quoted_addr); \
+ vstring_free(orcpt_buf); \
if (rcpt_buf) \
rcpb_free(rcpt_buf); \
if (dsn_buf) \
@@ -248,6 +250,19 @@
STR(printable_quoted_addr)),
ATTR_TYPE_END);
break;
+ case REC_TYPE_ORCP:
+ if (sender_seen == 0) {
+ msg_warn("%s: missing sender address: %s "
+ "-- skipping remainder of this file",
+ id, STR(printable_quoted_addr));
+ SHOWQ_CLEANUP_AND_RETURN;
+ }
+ if (*start == 0) /* can't happen? */
+ start = var_empty_addr;
+ quote_822_local(orcpt_buf, start);
+ /* For consistency with REC_TYPE_RCPT below. */
+ printable(STR(orcpt_buf), '?');
+ break;
case REC_TYPE_RCPT:
if (sender_seen == 0) {
msg_warn("%s: missing sender address: %s "
@@ -261,12 +276,14 @@
/* For consistency with recipients in bounce logfile. */
printable(STR(printable_quoted_addr), '?');
if (dup_filter == 0
- || htable_locate(dup_filter, STR(printable_quoted_addr)) == 0)
+ || htable_locate(dup_filter, STR(printable_quoted_addr)) == 0)
attr_print(client, ATTR_FLAG_MORE,
+ SEND_ATTR_STR(MAIL_ATTR_ORCPT, STR(orcpt_buf)),
SEND_ATTR_STR(MAIL_ATTR_RECIP,
STR(printable_quoted_addr)),
SEND_ATTR_STR(MAIL_ATTR_WHY, ""),
ATTR_TYPE_END);
+ vstring_strcpy(orcpt_buf, "");
break;
case REC_TYPE_MESG:
if (msg_size_ok && vstream_fseek(qfile, msg_size, SEEK_CUR) < 0)
@@ -325,6 +342,7 @@
htable_enter(dup_filter, rcpt->address, (void *) 0);
attr_print(client, ATTR_FLAG_MORE,
+ SEND_ATTR_STR(MAIL_ATTR_ORCPT, rcpt->orig_addr),
SEND_ATTR_STR(MAIL_ATTR_RECIP, rcpt->address),
SEND_ATTR_STR(MAIL_ATTR_WHY, dsn->reason),
ATTR_TYPE_END);
_______________________________________________
Postfix-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]