mc,

Could you please test the attached patch. This was fixed some time ago
in trunk, but I've backported the fix to 2.0 now.


mc wrote:
> Hi All,
> 
> Today I went through the source code of dbmail, and find that in
> quoted_string_out()...if a double quote is found in the source string,
> then a new string with format {length}"string" will be returned. After
> commenting out the part checking for double quotes, my Outlook Express
> no longer shows double quotes in those problematic senders/recipients
> mentioned earlier. I would like to ask if there are any possible
> negative impacts on this? Could this 'fix' be a violation against the
> imap standard? I don't know much about the standard, I am just seeing
> the same behavior on other imap implementations such as courier imap.
> and they worked fine for me in the past years.....
> 
> Thanks
> mc
> 
> 
> ----- Original Message ----- From: "mc" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, December 30, 2005 00:15
> Subject: [Dbmail] double quotes in outlook express
> 
> 
>> Hi all,
>>
>> Recently I discovered that for some (but not all) mails in Outlook
>> Express, double quotes are seen around the sender or recipient name.
>> After a few google hits, I found that there was a similar (or
>> identical?) problem in the 1.x series...however I am not using 1.x. I
>> am currently using 2.0.7. I would like to know if there are other
>> users on the list experience the same problem with me? and any
>> possibly workarounds for that?
>>
>> p.s.: From the 'fetch' output ...senders without double quote are
>> shown as "SENDER NAME" while those with double quotes are shown as
>> {11}"SENDER NAME" . could this be related?
>>
>> Thanks,
>> mc.
>> _______________________________________________
>> Dbmail mailing list
>> [email protected]
>> https://mailman.fastxs.nl/mailman/listinfo/dbmail
>>
> 
> _______________________________________________
> Dbmail-dev mailing list
> [email protected]
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 

-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl
diff --git a/imaputil.c b/imaputil.c
--- a/imaputil.c
+++ b/imaputil.c
@@ -2117,24 +2117,38 @@ int quoted_string_out(FILE * outstream, 
 {
 	int i, cnt;
 
+	char *t, *l = NULL;
+        char first, last, penult = '\\';
+
+        l = strdup(s);
+        t = l;
+        /* strip off dquote */
+        first = s[0];
+        last = s[strlen(s)-1];
+        if (strlen(s) > 2)
+                penult = s[strlen(s)-2];
+        if ((first == '"') && (last == '"') && (penult != '\\')) {
+                l[strlen(l)-1] = '\0';
+                l++;
+        }
+								
 	// check wheter we must use literal string
-	for (i = 0; s[i]; i++) {
-		if (!(s[i] & 0xe0) || (s[i] & 0x80) || (s[i] == '"')
-		    || (s[i] == '\\')) {
+	for (i = 0; l[i]; i++) {
+		if (!(l[i] & 0xe0) || (l[i] & 0x80) || (l[i] == '"') || (l[i] == '\\')) {
 			cnt = fprintf(outstream, "{");
-			cnt +=
-			    fprintf(outstream, "%lu",
-				    (unsigned long) strlen(s));
+			cnt += fprintf(outstream, "%lu", (unsigned long) strlen(l));
 			cnt += fprintf(outstream, "}\r\n");
-			cnt += fprintf(outstream, "%s", s);
+			cnt += fprintf(outstream, "%s", l);
 			return cnt;
 		}
 	}
 
 	cnt = fprintf(outstream, "\"");
-	cnt += fprintf(outstream, "%s", s);
+	cnt += fprintf(outstream, "%s", l);
 	cnt += fprintf(outstream, "\"");
 
+	dm_free(t);
+
 	return cnt;
 }
 

Reply via email to