From b6f8cf864a0f8019b7a4159f73c6e830939f4b99 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 19 Mar 2016 10:22:12 -0700 Subject: [PATCH] * Bug: Crash when attempting to read a message after a bounce command. In order to produce a crash one needed to use the ^T subcommand and do a search in a LDAP directory. The crash is produced by changes to the text in the title bar. Reported by Heinrich Mislik in the Alpine-info list. * Add ignore size option to Alpine, which helps users deal with some servers that compute sizes incorrectly but send complete messages when users save messages from those servers. --- alpine/mailcmd.c | 3 +++ alpine/titlebar.c | 19 ++++++++++++++++--- pith/conf.c | 2 ++ pith/conftype.h | 1 + pith/pine.hlp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ pith/save.c | 1 + 6 files changed, 71 insertions(+), 3 deletions(-) diff --git a/alpine/mailcmd.c b/alpine/mailcmd.c index a4fa524..e4208d2 100644 --- a/alpine/mailcmd.c +++ b/alpine/mailcmd.c @@ -3494,6 +3494,9 @@ save_size_changed_prompt(long msgno, int flags) {-1, 0, NULL, NULL} }; + if(F_ON(F_IGNORE_SIZE, ps_global)) + return 'y'; + if(flags & SSCP_INIT || flags & SSCP_END){ if(flags & SSCP_END && possible_corruption) q_status_message(SM_ORDER, 3, 3, "There is possible data corruption, check the results"); diff --git a/alpine/titlebar.c b/alpine/titlebar.c index 2fc35d8..fa825be 100644 --- a/alpine/titlebar.c +++ b/alpine/titlebar.c @@ -83,7 +83,8 @@ static struct titlebar_state { del_column, percent_column, page_column, - screen_cols; + screen_cols, + pushed; enum {Normal, OnlyRead, Closed} stream_status; TitleBarType style; TITLE_S titlecontainer; @@ -92,13 +93,20 @@ static struct titlebar_state { static int titlebar_is_dirty = 1; +char *as_fname; /* folder name */ +char *as_cname; /* context name */ void push_titlebar_state(void) { + as.pushed = 1; titlebar_stack = as; - as.folder_name = NULL; /* erase knowledge of malloc'd data */ - as.context_name = NULL; + if(as_fname) fs_give((void **)&as_fname); + as_fname = cpystr(as.folder_name); + if(as_cname) fs_give((void **)&as_cname); + as_cname = cpystr(as.context_name); + if(as.folder_name) fs_give((void **)&as.folder_name); + if(as.context_name) fs_give((void **)&as.context_name); } @@ -110,6 +118,11 @@ pop_titlebar_state(void) fs_give((void **)&(as.folder_name)); /* free malloc'd values */ fs_give((void **)&(as.context_name)); as = titlebar_stack; + if(as.pushed){ + as.folder_name = as_fname ? cpystr(as_fname) : NULL; + as.context_name = as_cname ? cpystr(as_cname): NULL; + } + as.pushed = 0; } } diff --git a/pith/conf.c b/pith/conf.c index 6a80393..6e32052 100644 --- a/pith/conf.c +++ b/pith/conf.c @@ -3140,6 +3140,8 @@ feature_list(int index) F_FULL_AUTO_EXPUNGE, h_config_full_auto_expunge, PREF_MISC, 0}, {"force-arrow-cursor", NULL, F_FORCE_ARROW, h_config_force_arrow, PREF_MISC, 0}, + {"ignore-size-changes", NULL, + F_IGNORE_SIZE, h_config_ignore_size, PREF_MISC, 0}, {"maildrops-preserve-state", NULL, F_MAILDROPS_PRESERVE_STATE, h_config_maildrops_preserve_state, PREF_MISC, 0}, diff --git a/pith/conftype.h b/pith/conftype.h index 3c9316f..afae74e 100644 --- a/pith/conftype.h +++ b/pith/conftype.h @@ -346,6 +346,7 @@ typedef enum { F_FORCE_ARROW, F_PRUNE_USES_ISO, F_ALT_ED_NOW, + F_IGNORE_SIZE, F_SHOW_DELAY_CUE, F_CANCEL_CONFIRM, F_AUTO_OPEN_NEXT_UNREAD, diff --git a/pith/pine.hlp b/pith/pine.hlp index 2e0fd0c..6b3ec1b 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -335,6 +335,12 @@ Bugs that have been addressed include: of the certificate to lowercase, which may make Alpine not be able to read such certificate. Reported by Dennis Davis. +
  • Bug: Crash when attempting to read a message after a bounce + command. In order to produce a crash one needed to use the ^T + subcommand and do a search in a LDAP directory. The crash is + produced by changes to the text in the title bar. Reported by + Heinrich Mislik in the Alpine-info list. +
  • Pico: Searching for a string that is too long causes Pico to crash in the next search. @@ -3771,6 +3777,7 @@ There are also additional details on
  • FEATURE:
  • FEATURE:
  • FEATURE: +
  • FEATURE:
  • FEATURE:
  • FEATURE:
  • FEATURE: @@ -31167,6 +31174,47 @@ but that is not implemented. <End of help on this topic> +====== h_config_ignore_size ===== + + +FEATURE: <!--#echo var="FEAT_ignore-size-changes"--> + + +

    FEATURE:

    + +When you have an account residing in an IMAP server, Alpine records the +size of each message as reported by the server. However, when Alpine saves +a message in such IMAP server, Alpine will compute the size of the message +independently, from the data it received. If these two numbers do not +match for a message, Alpine asks you if you still want to take the risk of +saving such message, since data corruption or loss of data could result +from this save. + +

    +Sometimes the root of this problem is that the IMAP server does not +compute sizes correctly, and there will not be loss of information when +saving such message. Enabling this feature will make Alpine ignore such +error and continue saving the message without producing any warnings or +ever stopping the process, as if there had not been any error. This option +applies to all IMAP servers that you use, so if you enable this feature, +size discrepancy warnings will not be given for any IMAP server you +connect to. + +

    +Example of a server where you could reproduce this problem is the Gmail +IMAP server. Another example can be found in some versions of the Exchange +server. + +

    +It is recommended that this feature be disabled most of the time and only +enabled when you find a server which you can determine that has the above +mentioned defect, but be disabled again after making the save operation +succeed. + +

    +<End of help on this topic> + + ====== h_config_force_low_speed ===== diff --git a/pith/save.c b/pith/save.c index e2e6865..f6f45b0 100644 --- a/pith/save.c +++ b/pith/save.c @@ -1157,6 +1157,7 @@ long save_fetch_append_cb(MAILSTREAM *stream, void *data, char **flags, snprintf(buf, sizeof(buf), "Message to save shrank: source msg # %ld may be saved incorrectly", mn_raw2m(pkg->msgmap, raw)); + if(F_OFF(F_IGNORE_SIZE, ps_global)) q_status_message(SM_ORDER, 0, 3, buf); } else{ -- 2.11.4.GIT