This is current/amd64 on a PC.
smtpd just failed to parse a SMTP response (below),
saying 'line too long'.
Looking at the source, this seems to be parse_smtp_response() in util.c,
which errors out right away with
if (len >= LINE_MAX)
return "line too long";
Apparently,
/usr/include/sys/syslimits.h:#define LINE_MAX 2048
is not enough, as shown by this line from
(you guessed it) outlook.office365.com:
[email protected]: 554 5.2.252 SendAsDenied; [email protected] not allowed to send
as [email protected];
STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied;
Failed to process message due to a permanent exception with message Cannot
submit message. 0.35250:CF3A0000, 1.36674:01000000, 1.61250:00000000,
1.45378:02000000, 1.44866:00000000, 1.36674:7A000000, 1.61250:00000000,
1.45378:05000000, 1.44866:00140000, 1.36674:0A000000, 1.61250:00000000,
1.45378:16000000, 1.44866:AE1A0000, 1.36674:0E000000, 1.61250:00000000,
1.45378:C71A0000, 1.44866:E0000000, 16.55847:EE0C0000,
17.43559:0000000030020000000000000100000000000000,
20.52176:140F69921A0000001F001432, 20.50032:140F69928A1770200201E265,
0.35180:40001E32, 255.23226:21000000, 255.27962:7A000000, 255.27962:0A000000,
255.27962:0E000000, 255.31418:03000136, 0.35250:0300A531, 1.36674:0A000000,
1.61250:00000000, 1.45378:02000000, 1.44866:18000000, 1.36674:32000000,
1.61250:00000000, 1.45378:1D000000, 1.44866:01000000, 16.55847:84000000,
17.43559:0000000088030000000000000000000000000000,
20.52176:140F69921A0070200A001380, 20.50032:140F69928A1710106F000000,
0.35180:03000B67, 255.23226:0A00CD30, 255.27962:0A000000, 255.27962:32000000,
255.17082:DC040000, 0.27745:79000000, 4.21921:DC040000, 255.27962:FA000000,
255.1494:7E000000, 0.38698:05000780, 1.41134:46000000, 0.37692:86000000,
0.37948:86000000, 5.33852:00000000534D545000000000,
7.36354:010000000000010986000000, 4.56248:DC040000,
7.40748:010000000000010B86000000, 7.57132:000000000000000086000000,
1.63016:32000000, 4.39640:DC040000,
8.45434:9A6929EA0096114FBBA64268B1990A8486000000, 1.46798:04000000,
5.10786:0000000031352E32302E343731332E3032363A414D39505230364D42383138303A65613539613834342D653163302D343234332D613934632D3263343563353536646533383A34353639323400DA101003000000,
7.51330:8C34EA6973AFD90807000000, 0.39570:03000000, 1.55954:0A000000,
0.49266:02000000, 1.33010:0A000000, 2.54258:00000000, 0.40002:7A000000,
1.56562:00000000, 1.64146:32000000, 1.33010:32000000, 2.54258:DC040000,
255.1750:0300
Yes, this is exactly 2048 bytes of an unfinished line.
(The actual error is my misconfiguration,
but that's beside the point here.)
There is also
smtp_session.c:#define SMTP_LINE_MAX 65535
which I guess would be the right replacement, but as this is
is only defined in one C file and I don't know the code base,
I'll leave that to someone else.
Naively, I am just removing the len >= condition,
which is probably not correct; I don't see where the
parsing function needs that, but perhaps this limitation
is relied upon elsewhere.
Jan
Index: util.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/util.c,v
retrieving revision 1.154
diff -u -p -r1.154 util.c
--- util.c 14 Jun 2021 17:58:16 -0000 1.154
+++ util.c 24 Nov 2021 17:59:14 -0000
@@ -685,9 +685,6 @@ session_socket_error(int fd)
const char *
parse_smtp_response(char *line, size_t len, char **msg, int *cont)
{
- if (len >= LINE_MAX)
- return "line too long";
-
if (len > 3) {
if (msg)
*msg = line + 4;