+2002-09-19
+
+ * src/rfc2015.c: check_signature(): corrected error handling and
+ fixed memory leak.
+
+2002-09-19
+
+ * src/rfc2015.c: check_signature(): correctly remove the last empty
+ line, and canonicalize the file part before verifying (this should
+ fix incompatibility with Evolution or some other MUAs).
+ * src/utils.[ch]: copy_file_part(): new. It copies the specified
+ range of file stream to another file.
+
2002-09-19
* src/compose.c: compose_write_to_file(): force BASE64 encoding for
+2002-09-19 [paul] 0.8.2claws60
+
+ * sync with 0.8.2cvs3
+ see ChangeLog 2002-09-19
+
2002-09-19 [paul] 0.8.2claws59
* src/prefs_folder_item.c
+2002-09-19
+
+ * src/rfc2015.c: check_signature(): ¥¨¥é¡¼½èÍý¤È¥á¥â¥ê¥ê¡¼¥¯¤ò½¤Àµ¡£
+
+2002-09-19
+
+ * src/rfc2015.c: check_signature(): ¸¡¾ÚÁ°¤Ë¥Õ¥¡¥¤¥ë¥Ñ¡¼¥È¤ÎºÇ¸å¤Î
+ ¶õ¹Ô¤òÀµ¤·¤¯½üµî¤·¡¢Àµµ¬²½¤¹¤ë¤è¤¦¤Ë¤·¤¿(Evolution ¤½¤Î¾ MUA
+ ¤È¤ÎÈó¸ß´¹À¤ò²ò¾Ã¤¹¤ë¤Ï¤º)¡£
+ * src/utils.[ch]: copy_file_part(): ¿·µ¬¡£»ØÄꤷ¤¿ÈϰϤΥե¡¥¤¥ë
+ ¥¹¥È¥ê¡¼¥à¤òÊ̤Υե¡¥¤¥ë¤Ë¥³¥Ô¡¼¤¹¤ë¡£
+
2002-09-19
* src/compose.c: compose_write_to_file(): 8-bit ¥Æ¥¥¹¥È¤Î½ð̾»þ¤Ë
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws59
+EXTRA_VERSION=claws60
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
GpgmeSigStat status = GPGME_SIG_STAT_NONE;
GpgmegtkSigStatus statuswindow = NULL;
const char *result = NULL;
+ gchar *tmp_file;
+ gint n_exclude_chars = 0;
if (prefs_common.gpg_signature_popup)
statuswindow = gpgmegtk_sig_status_create ();
goto leave;
}
- /* don't include the last character (LF). It does not belong to the
- * signed text */
- err = gpgme_data_new_from_filepart (&text, NULL, fp,
- mimeinfo->children->fpos,
- mimeinfo->children->size ?
- (mimeinfo->children->size - 1) : 0 );
+ /* don't include the last empty line.
+ It does not belong to the signed text */
+ if (mimeinfo->children->size > 0) {
+ if (fseek(fp, mimeinfo->children->fpos + mimeinfo->children->size - 1,
+ SEEK_SET) < 0) {
+ perror("fseek");
+ goto leave;
+ }
+ if (fgetc(fp) == '\n') {
+ n_exclude_chars++;
+ if (mimeinfo->children->size > 1) {
+ if (fseek(fp, mimeinfo->children->fpos + mimeinfo->children->size - 2,
+ SEEK_SET) < 0) {
+ perror("fseek");
+ goto leave;
+ }
+ if (fgetc(fp) == '\r')
+ n_exclude_chars++;
+ }
+ }
+ }
+
+ /* canonicalize the file part. */
+ tmp_file = get_tmp_file();
+ if (copy_file_part(fp, mimeinfo->children->fpos,
+ mimeinfo->children->size - n_exclude_chars,
+ tmp_file) < 0) {
+ g_free(tmp_file);
+ goto leave;
+ }
+ if (canonicalize_file_replace(tmp_file) < 0) {
+ unlink(tmp_file);
+ g_free(tmp_file);
+ goto leave;
+ }
+
+ err = gpgme_data_new_from_file(&text, tmp_file, 1);
+
+ unlink(tmp_file);
+ g_free(tmp_file);
+
if (!err)
err = gpgme_data_new_from_filepart (&sig, NULL, fp,
partinfo->fpos, partinfo->size);
return 0;
}
+gint copy_file_part(FILE *fp, off_t offset, size_t length, const gchar *dest)
+{
+ FILE *dest_fp;
+ gint n_read;
+ gint bytes_left, to_read;
+ gchar buf[BUFSIZ];
+ gboolean err = FALSE;
+
+ if (fseek(fp, offset, SEEK_SET) < 0) {
+ perror("fseek");
+ return -1;
+ }
+
+ if ((dest_fp = fopen(dest, "wb")) == NULL) {
+ FILE_OP_ERROR(dest, "fopen");
+ return -1;
+ }
+
+ if (change_file_mode_rw(dest_fp, dest) < 0) {
+ FILE_OP_ERROR(dest, "chmod");
+ g_warning("can't change file mode\n");
+ }
+
+ bytes_left = length;
+ to_read = MIN(bytes_left, sizeof(buf));
+
+ while ((n_read = fread(buf, sizeof(gchar), to_read, fp)) > 0) {
+ if (n_read < to_read && ferror(fp))
+ break;
+ if (fwrite(buf, n_read, 1, dest_fp) < 1) {
+ g_warning(_("writing to %s failed.\n"), dest);
+ fclose(dest_fp);
+ unlink(dest);
+ return -1;
+ }
+ bytes_left -= n_read;
+ if (bytes_left == 0)
+ break;
+ to_read = MIN(bytes_left, sizeof(buf));
+ }
+
+ if (ferror(fp)) {
+ perror("fread");
+ err = TRUE;
+ }
+ if (fclose(dest_fp) == EOF) {
+ FILE_OP_ERROR(dest, "fclose");
+ err = TRUE;
+ }
+
+ if (err) {
+ unlink(dest);
+ return -1;
+ }
+
+ return 0;
+}
+
/* convert line endings into CRLF. If the last line doesn't end with
* linebreak, add it.
*/
gint move_file (const gchar *src,
const gchar *dest,
gboolean overwrite);
+gint copy_file_part (FILE *fp,
+ off_t offset,
+ size_t length,
+ const gchar *dest);
gint canonicalize_file (const gchar *src,
const gchar *dest);
gint canonicalize_file_replace (const gchar *file);