diff --git a/appl/popper/pop_send.c b/appl/popper/pop_send.c index 9ce082624..30e03e744 100644 --- a/appl/popper/pop_send.c +++ b/appl/popper/pop_send.c @@ -136,14 +136,18 @@ pop_send(POP *p) return (pop_msg (p,POP_FAILURE,"SIGHUP or SIGPIPE flagged")); } /* Send the message body */ - while (fgets(buffer,MAXMSGLINELEN,p->drop)) { - /* Look for the start of the next message */ - if (strncmp(buffer,"From ",5) == 0) break; - /* Decrement the lines sent (for a TOP command) */ - if (msg_lines >= 0 && msg_lines-- == 0) break; - pop_sendline(p,buffer); - if (hangup) - return (pop_msg (p,POP_FAILURE,"SIGHUP or SIGPIPE flagged")); + { + int blank_line = 0; + while (fgets(buffer,MAXMSGLINELEN,p->drop)) { + /* Look for the start of the next message */ + if (blank_line && strncmp(buffer,"From ",5) == 0) break; + blank_line = (strncmp(buffer, "\n", 1) == 0); + /* Decrement the lines sent (for a TOP command) */ + if (msg_lines >= 0 && msg_lines-- == 0) break; + pop_sendline(p,buffer); + if (hangup) + return (pop_msg (p,POP_FAILURE,"SIGHUP or SIGPIPE flagged")); + } } /* "." signals the end of a multi-line transmission */ fputs(".\r\n",p->output); diff --git a/appl/popper/pop_updt.c b/appl/popper/pop_updt.c index 78b020bd9..23f9b140b 100644 --- a/appl/popper/pop_updt.c +++ b/appl/popper/pop_updt.c @@ -33,6 +33,8 @@ pop_updt (POP *p) long offset; /* New mail offset */ + int blank_line; + #ifdef DEBUG if (p->debug) { pop_log(p,POP_DEBUG,"Performing maildrop update..."); @@ -120,6 +122,7 @@ pop_updt (POP *p) if(p->debug) pop_log(p,POP_DEBUG,"Copying message %d.",mp->number); #endif /* DEBUG */ + blank_line = 1; for(status_written = doing_body = 0 ; fgets(buffer,MAXMSGLINELEN,p->drop);) { @@ -150,8 +153,9 @@ pop_updt (POP *p) fputs (buffer, md); } else { /* Body */ - if (strncmp(buffer,"From ",5) == 0) break; + if (blank_line && strncmp(buffer,"From ",5) == 0) break; fputs (buffer, md); + blank_line = (*buffer == '\n'); } } }