From: Kevin McCarthy Date: Tue, 5 Apr 2016 21:31:36 +0000 (-0700) Subject: Fix IDNA functions for systems without iconv. X-Git-Tag: neomutt-20160822~184^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1795554809ba1ae85f7bb92517aefb6df137204f;p=neomutt Fix IDNA functions for systems without iconv. The IDNA changes for SMTPUTF8 support introduced a bug for systems without iconv. For those systems, the local<->intl functions would return an error due to the charset conversion failing. Change mutt_idna.c back to being conditionally compiled, but this time based on HAVE_ICONV. If there is no iconv, stub out the functions in mutt_idna.h. --- diff --git a/Makefile.am b/Makefile.am index c689fb544..9afb6ce74 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,7 +33,7 @@ mutt_SOURCES = \ rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \ score.c send.c sendlib.c signal.c sort.c \ status.c system.c thread.c charset.c history.c lib.c \ - muttlib.c editmsg.c mbyte.c mutt_idna.c \ + muttlib.c editmsg.c mbyte.c \ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c nodist_mutt_SOURCES = $(BUILT_SOURCES) @@ -53,7 +53,7 @@ AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(GPGME_CFLAGS) -Iintl EXTRA_mutt_SOURCES = account.c bcache.c crypt-gpgme.c crypt-mod-pgp-classic.c \ crypt-mod-pgp-gpgme.c crypt-mod-smime-classic.c \ crypt-mod-smime-gpgme.c dotlock.c gnupgparse.c hcache.c md5.c \ - mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \ + mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \ mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \ pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \ smime.c smtp.c utf8.c wcwidth.c \ diff --git a/configure.ac b/configure.ac index fe18ecce4..6096dbb3c 100644 --- a/configure.ac +++ b/configure.ac @@ -1164,6 +1164,13 @@ fi # libiconv dnl -- IDN depends on iconv +dnl mutt_idna.c will perform charset transformations (for smtputf8 +dnl support) as long as at least iconv is installed. If there is no +dnl iconv, then it doesn't need to be included in the build. +if test "$am_cv_func_iconv" = yes; then + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o" +fi + AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for internationalized domain names]), [ if test "$with_idn" != "no" ; then diff --git a/mutt_idna.h b/mutt_idna.h index 48236a26c..192e08db6 100644 --- a/mutt_idna.h +++ b/mutt_idna.h @@ -45,6 +45,7 @@ #endif /* HAVE_LIBIDN */ +#ifdef HAVE_ICONV int mutt_addrlist_to_intl (ADDRESS *, char **); int mutt_addrlist_to_local (ADDRESS *); @@ -52,6 +53,32 @@ void mutt_env_to_local (ENVELOPE *); int mutt_env_to_intl (ENVELOPE *, char **, char **); const char *mutt_addr_for_display (ADDRESS *a); +#else +static inline int mutt_addrlist_to_intl (ADDRESS *addr, char **err) +{ + return 0; +} + +static inline int mutt_addrlist_to_local (ADDRESS *addr) +{ + return 0; +} + +static inline void mutt_env_to_local (ENVELOPE *env) +{ + return; +} + +static inline int mutt_env_to_intl (ENVELOPE *env, char **tag, char **err) +{ + return 0; +} + +static inline const char *mutt_addr_for_display (ADDRESS *a) +{ + return a->mailbox; +} +#endif /* HAVE_LIBICONV */ #endif