Hi,

right before the thread's 4th anniversary ;)

Andreas Weigel:
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.
Thanks for that fix.

        Wietse

Dragging the originally proposed patch, I just noticed that it was never actually applied, maybe it just got forgotten (and as I originally stated, it does currently not change any relevant behavior, as smtpd_proxy seems to always send out IDENT=[UNAVAILABLE] anyways). In case you would be willing to still apply it, I attach the patch again, created against the current postfix-3.7 branch.

Kind regards,

Andreas
diff --git a/postfix/src/smtpd/smtpd_proxy.c b/postfix/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