diff options
| -rw-r--r-- | imap/ChangeLog | 4 | ||||
| -rw-r--r-- | imap/configure.ac | 2 | ||||
| -rw-r--r-- | imap/fetch.c | 50 | ||||
| -rw-r--r-- | imap/imapd.c | 2 | ||||
| -rw-r--r-- | imap/imapscanclient.c | 1 | ||||
| -rw-r--r-- | imap/imapscanclient.h | 1 | ||||
| -rw-r--r-- | rfc2045/testrfc3676parsersuite.txt | 2 | 
7 files changed, 28 insertions, 34 deletions
| diff --git a/imap/ChangeLog b/imap/ChangeLog index d011c22..abb298a 100644 --- a/imap/ChangeLog +++ b/imap/ChangeLog @@ -1,3 +1,7 @@ +2020-11-30  Sam Varshavchik  <mrsam@courier-mta.com> + +	* imap: send corrupted Unicode alerts only for new messages. +  2020-11-04  Sam Varshavchik  <mrsam@courier-mta.com>  	* spec file: add BuildRequires: %{__make} (will be required in F34). diff --git a/imap/configure.ac b/imap/configure.ac index e538983..a85bb04 100644 --- a/imap/configure.ac +++ b/imap/configure.ac @@ -4,7 +4,7 @@ dnl  dnl Copyright 1998 - 2019 Double Precision, Inc.  See COPYING for  dnl distribution information. -AC_INIT(courier-imap, 5.0.11, [courier-users@lists.sourceforge.net]) +AC_INIT(courier-imap, 5.0.11.20201130, [courier-users@lists.sourceforge.net])  >confdefs.h  # Kill PACKAGE_ macros diff --git a/imap/fetch.c b/imap/fetch.c index 5daf150..257b295 100644 --- a/imap/fetch.c +++ b/imap/fetch.c @@ -61,8 +61,8 @@ extern void get_message_flags(struct imapscanmessageinfo *,  extern void append_flags(char *, struct imapflags *);  static int fetchitem(FILE **, int *, struct fetchinfo *, -	struct imapscaninfo *,  unsigned long, -	struct rfc2045 **); +		     struct imapscaninfo *,  unsigned long, +		     struct rfc2045 **, int *);  static void bodystructure(FILE *, struct fetchinfo *,  	struct imapscaninfo *,  unsigned long, @@ -250,6 +250,7 @@ int do_fetch(unsigned long n, int byuid, void *p)  	int	seen;  	int	open_err;  	int	unicode_err=0; +	int	report_unicode_err=0;  	fp=NULL;  	open_err=0; @@ -278,15 +279,11 @@ int do_fetch(unsigned long n, int byuid, void *p)  	while (fi)  	{  		int rc=fetchitem(&fp, &open_err, fi, ¤t_maildir_info, n-1, -				 &rfc2045p); +				 &rfc2045p, &unicode_err);  		if (rc > 0)  			seen=1; -		if (rc < 0) -		{ -			rc=0; -			unicode_err=1; -		} +  		if ((fi=fi->next) != 0)	writes(" ");  	}  	writes(")\r\n"); @@ -299,22 +296,6 @@ int do_fetch(unsigned long n, int byuid, void *p)  		return (0);  	} -	if (current_maildir_info.msgs[n-1].err8bitflag) -		unicode_err=0; - -	if (unicode_err) -	{ -		current_maildir_info.msgs[n-1].err8bitflag=1; - -		writes("* OK [ALERT] Message "); -		writen(n); -		writes(" appears to be a Unicode message and your" -		       " E-mail reader did not enable Unicode support." -		       " Please use an E-mail reader that supports" -		       " IMAP with UTF-8 (see" -		       " https://tools.ietf.org/html/rfc6855.html)\r\n"); -	} -  #if SMAP  	if (!smapflag)  #endif @@ -334,17 +315,31 @@ int do_fetch(unsigned long n, int byuid, void *p)  			reflag_filename(¤t_maildir_info.msgs[n-1],&flags,  				fileno(fp));  			current_maildir_info.msgs[n-1].changedflags=1; + +			report_unicode_err=unicode_err;  		}  	} +	if (report_unicode_err) +	{ +		writes("* OK [ALERT] Message "); +		writen(n); +		writes(" appears to be a Unicode message and your" +		       " E-mail reader did not enable Unicode support." +		       " Please use an E-mail reader that supports" +		       " IMAP with UTF-8 (see" +		       " https://tools.ietf.org/html/rfc6855.html)\r\n"); +	} +  	if (current_maildir_info.msgs[n-1].changedflags)  		fetchflags(n-1);  	return (0);  }  static int fetchitem(FILE **fp, int *open_err, struct fetchinfo *fi, -	struct imapscaninfo *i, unsigned long msgnum, -	struct rfc2045 **mimep) +		     struct imapscaninfo *i, unsigned long msgnum, +		     struct rfc2045 **mimep, +		     int *unicode_err)  {  	void (*fetchfunc)(FILE *, struct fetchinfo *,  			  struct imapscaninfo *, unsigned long, @@ -460,8 +455,7 @@ static int fetchitem(FILE **fp, int *open_err, struct fetchinfo *fi,  	if (mimecorrectness && !enabled_utf8 &&  	    ((*mimep)->rfcviolation & RFC2045_ERR8BITHEADER))  	{ -		/* Still return -1, in order to [ALERT] the client */ -		rc= -1; +		*unicode_err=1;  	}  	(*fetchfunc)(*fp, fi, i, msgnum, *mimep); diff --git a/imap/imapd.c b/imap/imapd.c index 095defb..c0b5908 100644 --- a/imap/imapd.c +++ b/imap/imapd.c @@ -1334,8 +1334,6 @@ void doNoop(int real_noop)  #endif  		new_maildir_info.msgs[j].copiedflag=  			current_maildir_info.msgs[i].copiedflag; -		new_maildir_info.msgs[j].err8bitflag= -			current_maildir_info.msgs[i].err8bitflag;  		++j;  	} diff --git a/imap/imapscanclient.c b/imap/imapscanclient.c index 515abc2..5ab7148 100644 --- a/imap/imapscanclient.c +++ b/imap/imapscanclient.c @@ -868,7 +868,6 @@ int	dowritecache=0;  		scaninfo->msgs[i].filename=tempinfo_array[i]->filename;  		scaninfo->msgs[i].keywordMsg=NULL;  		scaninfo->msgs[i].copiedflag=0; -		scaninfo->msgs[i].err8bitflag=0;  #if SMAP  		if (smapflag)  			scaninfo->msgs[i].recentflag=0; diff --git a/imap/imapscanclient.h b/imap/imapscanclient.h index 373bc83..2e516cb 100644 --- a/imap/imapscanclient.h +++ b/imap/imapscanclient.h @@ -23,7 +23,6 @@ struct imapscanmessageinfo {  	char storeflag;  /* Used by imap_addRemoveKeywords() */ -	char err8bitflag;       /* Invalid 8 bit header error was reported */  	/* When reading keywords, hash messages by filename */  	struct imapscanmessageinfo *firstBucket, *nextBucket; diff --git a/rfc2045/testrfc3676parsersuite.txt b/rfc2045/testrfc3676parsersuite.txt index f523981..93c87d5 100644 --- a/rfc2045/testrfc3676parsersuite.txt +++ b/rfc2045/testrfc3676parsersuite.txt @@ -109,5 +109,5 @@  [0: 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ...1234567890 1234567890 1234567890 1234567890 1234567890 1234567890] -[0: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234...1678901234567890123456789012345678901234567890123456789012345678901234567...190123456789012345678901234567890123456789012345678901234567890] +[0: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234...5678901234567890123456789012345678901234567890123456789012345678901234567...890123456789012345678901234567890123456789012345678901234567890] | 
