Show 25 quoted lines
> > +static bool has_required_headers(const char *line)
> > +{
> > + bool from = false, date = false, subject = false;
> > +
> > + while ((line = strchr(line, '\n')) && *++line != '\n') {
> > + if (starts_with(line, "From: "))
> > + from = true;
> > + else if (starts_with(line, "Date: "))
> > + date = true;
> > + else if (starts_with(line, "Subject: "))
> > + subject = true;
> > + }
> > + return from && date && subject;
> > +}
>
> The above assumes that an empty line that denotes the end of the
> header can be detected by looking for '\n\n' in the line[]. So this
> may be scanning thru to the end of the message including the body,
> because each and every line ends with CRLF and there is no two
> consecutive LF appearing in the line.
>
> I admit that it was eons ago I read RFCs on IMAP (like RFC 2060),
> but I recall that its definition explicitly called for CRLF line
> endings, and existing code in imap-send.c before these patches seems
> to expect that it is reading CRLF delimited lines.