[Mimedefang] Any way to get MD to accept a Postfix queue ID at RCPT time?
Dianne Skoll
dfs at roaringpenguin.com
Tue Apr 28 15:53:48 EDT 2015
Hi,
Actually, this is a more thought-through patch. I don't use Postfix, but
if any Postfix users would care to give this a try, I'd appreciate it.
Regards,
Dianne.
commit 936bebc684c7d2f8807fb8df72a2a920f4771e66
Author: Dianne Skoll <dfs at roaringpenguin.com>
Date: Tue Apr 28 15:51:45 2015 -0400
Postfix gives use the queue ID with the first RCPT: command, so handle that.
diff --git a/mimedefang.c b/mimedefang.c
index 636102f..6bffc0c 100644
--- a/mimedefang.c
+++ b/mimedefang.c
@@ -1206,6 +1206,31 @@ rcptto(SMFICTX *ctx, char **to)
return SMFIS_TEMPFAIL;
}
+ /* Apparently, Postfix offers an option to set the "i" macro at
+ rcptto time */
+ if (!data->qid || (data->qid == NOQUEUE)) {
+ char *queueid = smfi_getsymval(ctx, "i");
+ if (queueid && *queueid) {
+ if (!data->qid_written) {
+ /* Write this out separately; the write below may be skipped */
+ data->cmdFD = get_fd(data, "COMMANDS", data->cmdFD);
+ if (data->cmdFD >= 0) {
+ dbuf_init(&dbuf);
+ append_mx_command(&dbuf, 'Q', queueid);
+ if (write_dbuf(&dbuf, data->cmdFD, data, "COMMANDS") >= 0) {
+ data->qid_written = 1;
+ }
+ dbuf_free(&dbuf);
+ data->cmdFD = put_fd(data->cmdFD);
+ }
+ }
+ data->qid = strdup_with_log(queueid);
+ if (!data->qid) {
+ data->qid = NOQUEUE;
+ }
+ }
+ }
+
rcpt_mailer = smfi_getsymval(ctx, "{rcpt_mailer}");
if (!rcpt_mailer || !*rcpt_mailer) rcpt_mailer = "?";
More information about the MIMEDefang
mailing list