diff options
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | pop3.c | 17 | 
2 files changed, 12 insertions, 7 deletions
| @@ -2,6 +2,8 @@  (The `lines' figures total .c, .h, .l, and .y files under version control.) +* Fix pop3.c to avoid trouble with spurious dot terminations. +  fetchmail-5.4.5 (Mon Aug  7 03:25:23 EDT 2000), 19238 lines:  * Dave Zarzycki's patch to enhance plugins, adding %h and %p. @@ -39,6 +39,8 @@ char *sdps_envto;  static char lastok[POPBUFSIZE+1];  #endif /* OPIE_ENABLE */ +#define DOTLINE(s)	(s[0] == '.' && (s[1]=='\r'||s[1]=='\n'||s[1]=='\0')) +  int pop3_ok (int sock, char *argbuf)  /* parse command response */  { @@ -155,7 +157,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)  		while ((ok = gen_recv(sock, buffer, sizeof(buffer))) == 0)  		{ -		    if (buffer[0] == '.') +		    if (DOTLINE([0]))  			break;  		    if (strncasecmp(buffer, "rpa", 3) == 0)  			has_rpa = TRUE; @@ -274,13 +276,14 @@ pop3_gettopid( int sock, int num , char *id)      int got_it;      char buf [POPBUFSIZE+1];      sprintf( buf, "TOP %d 1", num ); -    if( (ok = gen_transact(sock, buf ) ) != 0 ) +    if ((ok = gen_transact(sock, buf )) != 0)         return ok;       got_it = 0; -    while((ok = gen_recv(sock, buf, sizeof(buf))) == 0) { -	if( buf[0] == '.' ) +    while ((ok = gen_recv(sock, buf, sizeof(buf))) == 0)  +    { +	if (DOTLINE(buf))  	    break; -	if( ! got_it && ! strncasecmp("Message-Id:", buf, 11 )) { +	if ( ! got_it && ! strncasecmp("Message-Id:", buf, 11 )) {  	    got_it = 1;  	    /* prevent stack overflows */  	    buf[IDLEN+12] = 0; @@ -450,7 +453,7 @@ static int pop3_getrange(int sock,  		*newp = 0;   		while ((ok = gen_recv(sock, buf, sizeof(buf))) == 0)  		{ - 		    if (buf[0] == '.') + 		    if (DOTLINE(buf))   			break;   		    else if (sscanf(buf, "%d %s", &num, id) == 2)  		    { @@ -489,7 +492,7 @@ static int pop3_getsizes(int sock, int count, int *sizes)  	{  	    int num, size; -	    if (buf[0] == '.') +	    if (DOTLINE(buf))  		break;  	    else if (sscanf(buf, "%d %d", &num, &size) == 2)  		sizes[num - 1] = size; | 
