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