From: mmj Date: Tue, 22 Jun 2004 08:50:26 +0000 (+1000) Subject: Quoted printable subjects are now matched against prefix as well X-Git-Tag: RELEASE_1_0_0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=018f5282e9323596df4b9d4aafcee642ea3dafc4;p=thirdparty%2Fmlmmj.git Quoted printable subjects are now matched against prefix as well --- diff --git a/ChangeLog b/ChangeLog index 6ad1ce60..cb02fc77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ + o Make sure we check if the Subject: prefix might be present in the + de-quoted printable version of the Subject. If so, don't add it. o Fix bug with queuefilename containing all kinds og chars when sending standard mails o Let mlmmj-send be capable of handling relayhost local users bounce probes diff --git a/VERSION b/VERSION index a3df0a69..6f4eebdf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.0 +0.8.1 diff --git a/include/strgen.h b/include/strgen.h index df49a2f7..89ec68fa 100644 --- a/include/strgen.h +++ b/include/strgen.h @@ -33,5 +33,6 @@ char *concatstr(int count, ...); char *hostnamestr(void); char *mydirname(const char *path); char *mybasename(const char *path); +char *cleanquotedp(char *qpstr); #endif /* STRGEN_H */ diff --git a/src/do_all_the_voodo_here.c b/src/do_all_the_voodo_here.c index 0cd58f77..2679f0d0 100644 --- a/src/do_all_the_voodo_here.c +++ b/src/do_all_the_voodo_here.c @@ -79,7 +79,7 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd, const char **delhdrs, struct mailhdr *readhdrs, struct strlist *allhdrs, const char *prefix) { - char *hdrline, *subject; + char *hdrline, *subject, *unqp; allhdrs->count = 0; allhdrs->strs = NULL; @@ -114,7 +114,9 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd, /* Add Subject: prefix if wanted */ if(prefix) { if(strncmp(hdrline, "Subject: ", 9) == 0) { - if(strstr(hdrline + 9, prefix) == NULL) { + unqp = cleanquotedp(hdrline + 9); + if(strstr(hdrline + 9, prefix) == NULL && + strstr(unqp, prefix) == NULL) { subject = concatstr(4, "Subject: ", prefix, " ", hdrline + 9); @@ -122,8 +124,10 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd, strlen(subject)); myfree(subject); myfree(hdrline); + myfree(unqp); continue; } + myfree(unqp); } } diff --git a/src/strgen.c b/src/strgen.c index 6398f435..4b632703 100644 --- a/src/strgen.c +++ b/src/strgen.c @@ -175,3 +175,40 @@ char *mybasename(const char *path) return ret; } + +char *cleanquotedp(char *qpstr) +{ + char *retstr = mymalloc(strlen(qpstr)); + char qc[3], *c = qpstr; + long qcval; + int i = 0; + + /* XXX: We only use this function for checking whether the subject + * prefix is only present, so the recoding is neither guaranteed + * complete nor correct */ + + qc[2] = '\0'; + while(*c != '\0') { + switch(*c) { + case '=': + qc[0] = *(++c); + qc[1] = *(++c); + c++; + qcval = strtol(qc, NULL, 16); + if(qcval) + retstr[i++] = (char)qcval; + break; + case '_': + retstr[i++] = ' '; + c++; + break; + default: + retstr[i++] = *(c++); + break; + } + } + + retstr[i] = '\0'; + + return retstr; +}