Hi everyone,

I stumbled upon a very minor bug with regard to parsing the supported XFORWARD attributes from the EHLO reply in smtpd_proxy: the last attribute is never acknowledged because when tokenizing, the appended '\r' is not removed and leads to a failed string comparison in name_code an thereby to the last attribute not being added to server_xforward_features. I guess this has so far never come up because the last in line of advertised XFORWARD attributes by postfix currently is IDENT, which seems to never be set in this scenario anyways(?). The attached patch should fix the issue.

This brings me to my actual question:
I wanted to access the equivalent of the sendmail{daemon_addr} macro from within a before-queue content filter, so I just modified postfix to add the DAEMONADDR attribute to the XFORWARD command, which worked perfectly for that one attribute (at least after applying the mentioned fix :) ). Is there a chance for such a change to be accepted upstream or are there even plans/willingness to add more (all?) (milter-)sendmail macros as XFORWARD attributes in future? The comment in src/cleanup/cleanup_milter.c:cleanup_milter_eval suggests that this thought is not entirely new.

Kind regards,
Andreas

diff --git a/src/smtpd/smtpd_proxy.c b/src/smtpd/smtpd_proxy.c
index b2e765b3..1c1f9fc4 100644
--- a/src/smtpd/smtpd_proxy.c
+++ b/src/smtpd/smtpd_proxy.c
@@ -388,7 +388,7 @@ static int smtpd_proxy_connect(SMTPD_STATE *state)
      */
     server_xforward_features = 0;
     lines = STR(proxy->reply);
-    while ((words = mystrtok(&lines, "\n")) != 0) {
+    while ((words = mystrtok(&lines, "\r\n")) != 0) {
 	if (mystrtok(&words, "- ") && (word = mystrtok(&words, " \t")) != 0) {
 	    if (strcasecmp(word, XFORWARD_CMD) == 0)
 		while ((word = mystrtok(&words, " \t")) != 0)

Reply via email to