+2005-10-19 [colin] 1.9.15cvs76
+
+ * src/common/utils.c
+ Use shorter mime boundaries to avoid having
+ MTAs rewrapping our headers, breaking the
+ PGP signature in the process
+ * src/compose.c
+ * src/plugins/pgpmime/pgpmime.c
+ Check for boundary uniqueness to be sure
+ it won't happen, instead of hoping for the
+ best
+
2005-10-19 [colin] 1.9.15cvs75
* sylpheed-claws.desktop
( cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/plugins/pgpcore/passphrase.c; ) > 1.9.15cvs73.patchset
( cvs diff -u -r 1.213.2.64 -r 1.213.2.65 src/folder.c; cvs diff -u -r 1.207.2.74 -r 1.207.2.75 src/folderview.c; ) > 1.9.15cvs74.patchset
( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 sylpheed-claws.desktop; cvs diff -u -r 1.155.2.33 -r 1.155.2.34 src/Makefile.am; cvs diff -u -r 1.207.2.75 -r 1.207.2.76 src/folderview.c; cvs diff -u -r 1.115.2.60 -r 1.115.2.61 src/main.c; cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/wizard.c; ) > 1.9.15cvs75.patchset
+( cvs diff -u -r 1.382.2.184 -r 1.382.2.185 src/compose.c; cvs diff -u -r 1.36.2.45 -r 1.36.2.46 src/common/utils.c; cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/plugins/pgpmime/pgpmime.c; ) > 1.9.15cvs76.patchset
MICRO_VERSION=15
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=75
+EXTRA_VERSION=76
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
* uniqueness if everything is either quoted-printable or base64
* encoded (note that conversion is allowed), but because MIME bodies
* may be nested, it may happen that the same boundary has already
- * been used. We avoid scanning the message for conflicts and hope the
- * best.
+ * been used.
*
* boundary := 0*69<bchars> bcharsnospace
* bchars := bcharsnospace / " "
static gchar tbl[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"1234567890+_./=";
- gchar buf_uniq[17];
- gchar buf_date[64];
+ gchar buf_uniq[24];
gint i;
for (i = 0; i < sizeof(buf_uniq) - 1; i++)
buf_uniq[i] = tbl[g_random_int_range(0, sizeof(tbl) - 1)];
buf_uniq[i] = '\0';
- get_rfc822_date(buf_date, sizeof(buf_date));
- subst_char(buf_date, ' ', '_');
- subst_char(buf_date, ',', '_');
- subst_char(buf_date, ':', '_');
-
- return g_strdup_printf("%s_%s_%s", prefix ? prefix : "Multipart",
- buf_date, buf_uniq);
+ return g_strdup_printf("%s_%s", prefix ? prefix : "MP",
+ buf_uniq);
}
gint change_file_mode_rw(FILE *fp, const gchar *file)
/* append attachment parts */
if (compose_use_attach(compose)) {
MimeInfo *mimempart;
-
+ gchar *boundary = NULL;
mimempart = procmime_mimeinfo_new();
mimempart->content = MIMECONTENT_EMPTY;
mimempart->type = MIMETYPE_MULTIPART;
mimempart->subtype = g_strdup("mixed");
+
+ do {
+ if (boundary)
+ g_free(boundary);
+ boundary = generate_mime_boundary(NULL);
+ } while (strstr(buf, boundary) != NULL);
+
g_hash_table_insert(mimempart->typeparameters, g_strdup("boundary"),
- generate_mime_boundary(NULL));
+ boundary);
mimetext->disposition = DISPOSITIONTYPE_INLINE;
MimeInfo *msgcontent, *sigmultipart, *newinfo;
gchar *textstr, *micalg;
FILE *fp;
- gchar *boundary, *sigcontent;
+ gchar *boundary = NULL;
+ gchar *sigcontent;
gpgme_ctx_t ctx;
gpgme_data_t gpgtext, gpgsig;
size_t len;
struct passphrase_cb_info_s info;
gpgme_sign_result_t result = NULL;
+ gchar *test_msg;
+
+ fp = my_tmpfile();
+ procmime_write_mimeinfo(mimeinfo, fp);
+ rewind(fp);
+ /* read temporary file into memory */
+ test_msg = file_read_stream_to_str(fp);
+ fclose(fp);
+
memset (&info, 0, sizeof info);
/* remove content node from message */
sigmultipart = procmime_mimeinfo_new();
sigmultipart->type = MIMETYPE_MULTIPART;
sigmultipart->subtype = g_strdup("signed");
- boundary = generate_mime_boundary("Signature");
+
+ do {
+ if (boundary)
+ g_free(boundary);
+ boundary = generate_mime_boundary("Sig");
+ } while (strstr(test_msg, boundary) != NULL);
+
+ g_free(test_msg);
+
g_hash_table_insert(sigmultipart->typeparameters, g_strdup("boundary"),
g_strdup(boundary));
g_hash_table_insert(sigmultipart->typeparameters, g_strdup("protocol"),