Commit f04c8cfa authored by Matteo F. Vescovi's avatar Matteo F. Vescovi

Imported Upstream version 1.5.22

parent 594a6a48
This diff is collapsed.
......@@ -17,7 +17,7 @@ if BUILD_HCACHE
HCVERSION = hcversion.h
endif
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h $(HCVERSION)
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION)
bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
mutt_SOURCES = \
......@@ -73,7 +73,8 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
README.SSL smime.h group.h \
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
ChangeLog mkchangelog.sh mutt_idna.h \
snprintf.c regex.c crypt-gpgme.h hcachever.sh.in
snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
txt2c.c txt2c.sh version.sh check_sec.sh
EXTRA_SCRIPTS = smime_keys
......@@ -94,9 +95,26 @@ noinst_PROGRAMS = $(MUTT_MD5)
mutt_dotlock.c: dotlock.c
cp $(srcdir)/dotlock.c mutt_dotlock.c
# If this fails, we will fall back to the implementation in txt2c.sh
txt2c: txt2c.c
-$${NATIVECC-$(CC)} -o $@ $<
conststrings.c: txt2c config.status
( \
$(CC) -v || \
$(CC) --version || \
$(CC) -V || \
echo "unknown compiler"; \
) 2>&1 | ${srcdir}/txt2c.sh cc_version >conststrings_c
echo "$(CFLAGS)" | ${srcdir}/txt2c.sh cc_cflags >>conststrings_c
grep ac_cs_config= config.status | \
cut -d= -f2- | \
sed -e 's/^"//' -e 's/"$$//' | ${srcdir}/txt2c.sh configure_options >>conststrings_c
mv -f conststrings_c conststrings.c
CLEANFILES = mutt_dotlock.c keymap_alldefs.h $(BUILT_SOURCES)
DISTCLEANFILES= flea smime_keys
DISTCLEANFILES= flea smime_keys txt2c po/mutt.pot
ACLOCAL_AMFLAGS = -I m4
......@@ -139,7 +157,7 @@ install-exec-hook:
if test -f $(DESTDIR)$(bindir)/mutt_dotlock && test x@DOTLOCK_GROUP@ != x ; then \
chgrp @DOTLOCK_GROUP@ $(DESTDIR)$(bindir)/mutt_dotlock && \
chmod @DOTLOCK_PERMISSION@ $(DESTDIR)$(bindir)/mutt_dotlock || \
{ echo "Can't fix mutt_dotlock's permissions!" >&2 ; exit 1 ; } \
{ echo "Can't fix mutt_dotlock's permissions! This is required to lock mailboxes in the mail spool directory." >&2 ; exit 1 ; } \
fi
install-data-local:
......
This diff is collapsed.
......@@ -4,8 +4,19 @@ mutt. Please read this file carefully when upgrading your installation.
The keys used are:
!: modified feature, -: deleted feature, +: new feature
hg tip:
1.5.22 (2013-xx-xx):
! $imap_keepalive default lowered to 300
+ $reflow_text, $reflow_wrap for finer control of flowed wrapping
+ Support for TLSv1.1 and TLSv1.2. $ssl_use_tlsv1_1 and $ssl_tlsv1_2
variables control whether the new protocols are used.
! $ssl_use_tlsv1 now specifically refers to TLSv1.0.
1.5.21 (2010-09-15):
+ $mail_check_recent controls whether all unread mail or only new mail
since the last mailbox visit will be reported as new
+ %D format expando for $folder_format
! $thorough_search defaults to yes
+ imap-logout-all closes all open IMAP connections
! header/body cache paths are always UTF-8
......
......@@ -43,7 +43,7 @@ typedef struct
{
char user[64];
char login[64];
char pass[64];
char pass[128];
char host[128];
unsigned short port;
unsigned char type;
......
This diff is collapsed.
......@@ -33,7 +33,7 @@
#define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x
static struct mapping_t AliasHelp[] = {
static const struct mapping_t AliasHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
......
......@@ -34,17 +34,17 @@
#include <stdlib.h>
#include "ascii.h"
int ascii_isupper (int c)
inline int ascii_isupper (int c)
{
return (c >= 'A') && (c <= 'Z');
}
int ascii_islower (int c)
inline int ascii_islower (int c)
{
return (c >= 'a') && (c <= 'z');
}
int ascii_toupper (int c)
inline int ascii_toupper (int c)
{
if (ascii_islower (c))
return c & ~32;
......@@ -52,7 +52,7 @@ int ascii_toupper (int c)
return c;
}
int ascii_tolower (int c)
inline int ascii_tolower (int c)
{
if (ascii_isupper (c))
return c | 32;
......@@ -71,10 +71,15 @@ int ascii_strcasecmp (const char *a, const char *b)
if (b == NULL && a)
return 1;
for (; *a || *b; a++, b++)
for (;; a++, b++)
{
if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
return i;
/* test for NUL here rather that in the for loop in order to detect unqual
* length strings (see http://dev.mutt.org/trac/ticket/3601)
*/
if (!*a)
break;
}
return 0;
......
......@@ -293,49 +293,6 @@ int mutt_edit_attachment (BODY *a)
}
/* for compatibility with metamail */
static int is_mmnoask (const char *buf)
{
char tmp[LONG_STRING], *p, *q;
int lng;
if ((p = getenv ("MM_NOASK")) != NULL && *p)
{
if (mutt_strcmp (p, "1") == 0)
return (1);
strfcpy (tmp, p, sizeof (tmp));
p = tmp;
while ((p = strtok (p, ",")) != NULL)
{
if ((q = strrchr (p, '/')) != NULL)
{
if (*(q+1) == '*')
{
if (ascii_strncasecmp (buf, p, q-p) == 0)
return (1);
}
else
{
if (ascii_strcasecmp (buf, p) == 0)
return (1);
}
}
else
{
lng = mutt_strlen (p);
if (buf[lng] == '/' && mutt_strncasecmp (buf, p, lng) == 0)
return (1);
}
p = NULL;
}
}
return (0);
}
void mutt_check_lookup_list (BODY *b, char *type, int len)
{
LIST *t = MimeLookupList;
......@@ -371,40 +328,6 @@ void mutt_check_lookup_list (BODY *b, char *type, int len)
}
}
int mutt_is_autoview (BODY *b, const char *type)
{
LIST *t = AutoViewList;
char _type[SHORT_STRING];
int i;
if (!type)
snprintf (_type, sizeof (_type), "%s/%s", TYPE (b), b->subtype);
else
strncpy (_type, type, sizeof(_type));
mutt_check_lookup_list (b, _type, sizeof(_type));
type = _type;
if (mutt_needs_mailcap (b))
{
if (option (OPTIMPLICITAUTOVIEW))
return 1;
if (is_mmnoask (type))
return 1;
}
for (; t; t = t->next) {
i = mutt_strlen (t->data) - 1;
if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
ascii_strncasecmp (type, t->data, i) == 0) ||
ascii_strcasecmp (type, t->data) == 0)
return 1;
}
return 0;
}
/* returns -1 on error, 0 or the return code from mutt_do_pager() on success */
int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
ATTACHPTR **idx, short idxlen)
......@@ -582,8 +505,39 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
if (flag == M_AS_TEXT)
{
/* just let me see the raw data */
if (mutt_save_attachment (fp, a, pagerfile, 0, NULL))
goto return_error;
if (fp)
{
/* Viewing from a received message.
*
* Don't use mutt_save_attachment() because we want to perform charset
* conversion since this will be displayed by the internal pager.
*/
STATE decode_state;
memset(&decode_state, 0, sizeof(decode_state));
decode_state.fpout = safe_fopen(pagerfile, "w");
if (!decode_state.fpout)
{
dprint(1, (debugfile, "mutt_view_attachment:%d safe_fopen(%s) errno=%d %s\n", __LINE__, pagerfile, errno, strerror(errno)));
mutt_perror(pagerfile);
mutt_sleep(1);
goto return_error;
}
decode_state.fpin = fp;
decode_state.flags = M_CHARCONV;
mutt_decode_attachment(a, &decode_state);
if (fclose(decode_state.fpout) == EOF)
dprint(1, (debugfile, "mutt_view_attachment:%d fclose errno=%d %s\n", __LINE__, pagerfile, errno, strerror(errno)));
}
else
{
/* in compose mode, just copy the file. we can't use
* mutt_decode_attachment() since it assumes the content-encoding has
* already been applied
*/
if (mutt_save_attachment(fp, a, pagerfile, 0, NULL))
goto return_error;
}
}
else
{
......@@ -798,12 +752,10 @@ int mutt_save_attachment (FILE *fp, BODY *m, char *path, int flags, HEADER *hdr)
else
{
/* In recv mode, extract from folder and decode */
STATE s;
memset (&s, 0, sizeof (s));
s.flags |= M_CHARCONV;
if ((s.fpout = mutt_save_attachment_open (path, flags)) == NULL)
{
mutt_perror ("fopen");
......@@ -812,7 +764,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, char *path, int flags, HEADER *hdr)
}
fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
if (fclose (s.fpout) != 0)
{
mutt_perror ("fclose");
......
......@@ -42,7 +42,7 @@
#include <errno.h>
#include <locale.h>
static struct mapping_t FolderHelp[] = {
static const struct mapping_t FolderHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Chdir"), OP_CHANGE_DIRECTORY },
{ N_("Mask"), OP_ENTER_MASK },
......@@ -325,7 +325,7 @@ folder_format_str (char *dest, size_t destlen, size_t col, char op, const char *
}
static void add_folder (MUTTMENU *m, struct browser_state *state,
const char *name, const struct stat *s, int new)
const char *name, const struct stat *s, unsigned int new)
{
if (state->entrylen == state->entrymax)
{
......
......@@ -29,7 +29,7 @@ struct folder_file
char *name;
char *desc;
unsigned short new;
unsigned int new;
#ifdef USE_IMAP
char delim;
......
......@@ -454,7 +454,8 @@ int mutt_buffy_check (int force)
break;
case M_MH:
if ((tmp->new = mh_buffy (tmp->path)) > 0)
mh_buffy(tmp);
if (tmp->new)
BuffyCount++;
break;
}
......
......@@ -47,3 +47,5 @@ void mutt_buffy_cleanup (const char *buf, struct stat *st);
/* mark mailbox just left as already notified */
void mutt_buffy_setnotified (const char *path);
void mh_buffy (BUFFY *);
......@@ -50,10 +50,10 @@
* a preferred MIME name is given.
*/
static struct
static const struct
{
char *key;
char *pref;
const char *key;
const char *pref;
}
PreferredMIMENames[] =
{
......
#!/bin/sh --
#
# grep for some things which may look like security problems.
#
TMPFILE="`mktemp check_sec.tmp.XXXXXX`" || exit 1
RV=0;
do_check_files ()
{
pattern="$1" ; shift
magic="$1" ; shift
msg="$1" ; shift
egrep -n "$pattern" "$@" | \
grep -v '^[^ ]*:[^ ]*#' | \
fgrep -v "$magic" > $TMPFILE
test -s $TMPFILE && {
echo "$msg" ;
cat $TMPFILE;
rm -f $TMPFILE;
RV=1;
}
}
do_check ()
{
do_check_files "$1" "$2" "$3" `find . -path ./intl -prune -o -name '*.c' -print`
}
do_check '\<fopen.*'\"'.*w' __FOPEN_CHECKED__ "Alert: Unchecked fopen calls."
do_check '\<fclose.*'\"'.*w' __FCLOSE_CHECKED__ "Alert: Unchecked fclose calls."
do_check '\<(mutt_)?strcpy' __STRCPY_CHECKED__ "Alert: Unchecked strcpy calls."
do_check '\<strcat' __STRCAT_CHECKED__ "Alert: Unchecked strcat calls."
do_check '\<sprintf.*%s' __SPRINTF_CHECKED__ "Alert: Unchecked sprintf calls."
do_check '\<strncat' __STRNCAT_CHECKED__ "You probably meant safe_strcat here."
do_check '\<safe_free' __SAFE_FREE_CHECKED__ "You probably meant FREE here."
do_check '\<FREE[ ]?\([^&]' __FREE_CHECKED__ "You probably meant FREE(&...) here."
# don't do this check on others' code.
do_check_files '\<(malloc|realloc|free|strdup)[ ]*\(' __MEM_CHECKED__ "Alert: Use of traditional memory management calls." \
*.c imap/*.c
rm -f $TMPFILE
exit $RV
......@@ -55,7 +55,7 @@ typedef struct color_list
static COLOR_LIST *ColorList = NULL;
static int UserColors = 0;
static struct mapping_t Colors[] =
static const struct mapping_t Colors[] =
{
{ "black", COLOR_BLACK },
{ "blue", COLOR_BLUE },
......@@ -73,7 +73,7 @@ static struct mapping_t Colors[] =
#endif /* HAVE_COLOR */
static struct mapping_t Fields[] =
static const struct mapping_t Fields[] =
{
{ "hdrdefault", MT_COLOR_HDEFAULT },
{ "quoted", MT_COLOR_QUOTED },
......@@ -159,7 +159,7 @@ void ci_start_color (void)
#ifdef USE_SLANG_CURSES
static char *get_color_name (char *dest, size_t destlen, int val)
{
static char * missing[3] = {"brown", "lightgray", "default"};
static const char * const missing[3] = {"brown", "lightgray", "default"};
int i;
switch (val)
......@@ -769,13 +769,6 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
else
ColorDefs[object] = fgbgattr_to_color(fg, bg, attr);
#ifdef HAVE_COLOR
# ifdef HAVE_BKGDSET
if (object == MT_COLOR_NORMAL && !option (OPTNOCURSES) && has_colors())
BKGDSET (MT_COLOR_NORMAL);
# endif
#endif
return (r);
}
......
......@@ -611,27 +611,30 @@ void mutt_shell_escape (void)
void mutt_enter_command (void)
{
BUFFER err, token;
char buffer[LONG_STRING], errbuf[LONG_STRING];
char buffer[LONG_STRING];
int r;
buffer[0] = 0;
if (mutt_get_field (":", buffer, sizeof (buffer), M_COMMAND) != 0 || !buffer[0])
return;
err.data = errbuf;
err.dsize = sizeof (errbuf);
memset (&token, 0, sizeof (token));
mutt_buffer_init (&err);
err.dsize = STRING;
err.data = safe_malloc(err.dsize);
mutt_buffer_init (&token);
r = mutt_parse_rc_line (buffer, &token, &err);
FREE (&token.data);
if (errbuf[0])
if (err.data[0])
{
/* since errbuf could potentially contain printf() sequences in it,
we must call mutt_error() in this fashion so that vsprintf()
doesn't expect more arguments that we passed */
if (r == 0)
mutt_message ("%s", errbuf);
mutt_message ("%s", err.data);
else
mutt_error ("%s", errbuf);
mutt_error ("%s", err.data);
}
FREE (&err.data);
}
void mutt_display_address (ENVELOPE *env)
......
......@@ -74,7 +74,7 @@ enum
#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
#define W (COLS - HDR_XOFFSET)
static char *Prompts[] =
static const char * const Prompts[] =
{
"From: ",
"To: ",
......@@ -85,7 +85,7 @@ static char *Prompts[] =
"Fcc: "
};
static struct mapping_t ComposeHelp[] = {
static const struct mapping_t ComposeHelp[] = {
{ N_("Send"), OP_COMPOSE_SEND_MESSAGE },
{ N_("Abort"), OP_EXIT },
{ "To", OP_COMPOSE_EDIT_TO },
......@@ -110,8 +110,6 @@ static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num)
static void redraw_crypt_lines (HEADER *msg)
{
int off = 0;
mvaddstr (HDR_CRYPT, 0, "Security: ");
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
......@@ -148,11 +146,11 @@ static void redraw_crypt_lines (HEADER *msg)
clrtoeol ();
if ((WithCrypto & APPLICATION_PGP)
&& msg->security & APPLICATION_PGP && msg->security & SIGN)
&& (msg->security & APPLICATION_PGP) && (msg->security & SIGN))
printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
if ((WithCrypto & APPLICATION_SMIME)
&& msg->security & APPLICATION_SMIME && msg->security & SIGN) {
&& (msg->security & APPLICATION_SMIME) && (msg->security & SIGN)) {
printw ("%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
}
......@@ -163,7 +161,6 @@ static void redraw_crypt_lines (HEADER *msg)
&& *SmimeCryptAlg) {
mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
NONULL(SmimeCryptAlg));
off = 20;
}
}
......@@ -267,11 +264,9 @@ static void draw_envelope (HEADER *msg, char *fcc)
SETCOLOR (MT_COLOR_STATUS);
mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
BKGDSET (MT_COLOR_STATUS);
clrtoeol ();
BKGDSET (MT_COLOR_NORMAL);
SETCOLOR (MT_COLOR_NORMAL);
NORMAL_COLOR;
}
static int edit_address_list (int line, ADDRESS **addr)
......@@ -550,9 +545,10 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
{
mutt_str_replace (&msg->env->subject, buf);
move (HDR_SUBJECT, HDR_XOFFSET);
clrtoeol ();
if (msg->env->subject)
mutt_paddstr (W, msg->env->subject);
else
clrtoeol();
}
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
......@@ -1216,7 +1212,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (!(WithCrypto & APPLICATION_PGP))
break;
if ((WithCrypto & APPLICATION_SMIME)
&& msg->security & APPLICATION_SMIME)
&& (msg->security & APPLICATION_SMIME))
{
if (mutt_yesorno (_("S/MIME already selected. Clear & continue ? "),
M_YES) != M_YES)
......@@ -1242,7 +1238,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
break;
if ((WithCrypto & APPLICATION_PGP)
&& msg->security & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
{
if (mutt_yesorno (_("PGP already selected. Clear & continue ? "),
M_YES) != M_YES)
......@@ -1268,16 +1264,14 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
}
/* Draw formated compose status line */
/* Draw formatted compose status line */
if (menu->redraw & REDRAW_STATUS)
{
compose_status_line (buf, sizeof (buf), 0, menu, NONULL(ComposeFormat));
CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
move(option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
SETCOLOR (MT_COLOR_STATUS);
BKGDSET (MT_COLOR_STATUS);
mutt_paddstr (COLS, buf);
SETCOLOR (MT_COLOR_NORMAL);
BKGDSET (MT_COLOR_NORMAL);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
}
}
......
This diff is collapsed.
......@@ -148,6 +148,9 @@
/* Define if <iconv.h> defines iconv_t. */
#undef HAVE_ICONV_T_DEF
/* Define to 1 if you have the <idna.h> header file. */
#undef HAVE_IDNA_H
/* Define to 1 if you have the `idna_to_ascii_8z' function. */
#undef HAVE_IDNA_TO_ASCII_8Z
......@@ -166,6 +169,12 @@
/* Define to 1 if you have the `idna_to_unicode_utf8_from_utf8' function. */
#undef HAVE_IDNA_TO_UNICODE_UTF8_FROM_UTF8
/* Define to 1 if you have the <idn/idna.h> header file. */
#undef HAVE_IDN_IDNA_H
/* Define to 1 if you have the <idn/stringprep.h> header file. */
#undef HAVE_IDN_STRINGPREP_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......@@ -217,7 +226,7 @@
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if you have the `idn' library */
/* Define to 1 if you have the GNU idn library */
#undef HAVE_LIBIDN
/* Define to 1 if you have the `intl' library (-lintl). */
......@@ -244,7 +253,7 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if the system has the type `long long int'. */
/* Define to 1 if the system has the type 'long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the <malloc.h> header file. */
......@@ -355,6 +364,9 @@
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <stringprep.h> header file. */
#undef HAVE_STRINGPREP_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
......@@ -415,6 +427,9 @@
/* Define to 1 if you have the <unix.h> header file. */
#undef HAVE_UNIX_H
/* Define to 1 if the system has the type 'unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define if you have use_default_colors, as a function or macro. */
#undef HAVE_USE_DEFAULT_COLORS
......@@ -472,6 +487,9 @@
/* Where to find mixmaster on your system. */
#undef MIXMASTER
/* Full textual version string. */
#undef MUTT_VERSION
/* Define if you have problems with mutt not detecting new/old mailboxes over
NFS. Some NFS implementations incorrectly cache the attributes of small
files. */
......@@ -498,12 +516,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE