Fix 'From ' line parsing bug.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1588 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-04-18 00:36:07 +00:00
parent 5c5947ce69
commit bab8258a2d
2 changed files with 17 additions and 9 deletions

View File

@@ -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);

View File

@@ -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');
}
}
}