summaryrefslogtreecommitdiffstats
path: root/mutt_idna.c
AgeCommit message (Collapse)Author
2020-05-06Support domain-literal values in email adddresses.Kevin McCarthy
RFC 5322 defines the domain-literal: domain = dot-atom / domain-literal / obs-domain domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS] dtext = %d33-90 / ; Printable US-ASCII %d94-126 / ; characters not including obs-dtext ; "[", "]", or "\" RFC 5321 defines possible literal values in section 4.1.3. I think this was unnoticed (and possibly unimplemented) because it's a rare use-case. However, Stuart Gathman @sdgathman in the ticket (#226) noted: The use case is replacing alpine with mutt for this fully decentralized usage: https://fedoramagazine.org/decentralize-common-fedora-apps-cjdns/ The only requirements are to support IPv6 and IPv6 literals (to avoid use of DNS). Adding this slightly complicates the parser, because we can't wait to decide whether it's a domain-literal until parse_mailboxdomain(), but we also need to accommodate the CFWS. Break out a parse_domain() function, with partial duplication of parse_mailboxdomain()'s logic. Also, add parse_literal() to the outer parser, because we need to handle both name-addr and top level addr-spec. The RFC822Errors[] are currently unused (and broken), but add a new error code and message, in case those get fixed up and introduced to the code in the future. Disable IDNA encoding for domain-literals.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-31Remove trailing whitespace.Kevin McCarthy
The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
2018-04-15Add libidn2 supportMatej Muzila
2016-01-01Convert copyright years to all use 4 digit years.Kevin McCarthy
Vincent Lefèvre pointed out the common shortcut, e.g 1996-9, is actually not allowed for copyright years. Convert all the copyright years (for mutt files) to use 4 digits.
2016-01-01Update copyright notices.Kevin McCarthy
This patch only updates existing copyright notices in the source files, using commit dates since the last copyright update in commits e3af935cdb1a and f8fd60d8d3f2. Add a notice to the COPYRIGHT file to refer to our mercurial repository for the full commit history. Add myself to the COPYRIGHT file and smime_keys.pl file.
2015-11-24Fix bad idn error on local mailboxes. (closes #3795)Kevin McCarthy
Commit 831abf39d53a pulled the mbox_to_udomain() call inside the conversion functions. Unfortunately, this causes local (user only) mailboxes to be considered conversion errors instead of just skipping them. Revert mbox_to_udomain() back to using a static buffer and pull back into the mutt_addrlist_to_local/intl() functions. Pass the user and domain into the conversion functions instead of the address.
2015-11-24Add user reversibility check in intl_to_local.Kevin McCarthy
This ensures we don't lose information by converting to the local charset.
2015-11-24Add option 'idn_encode'; rename option 'use_idn' to 'idn_decode'.Kevin McCarthy
This is patch 3 of 4 implementing support for SMTPUTF8 (RFC 6531). Add an option to control whether international domains are encoded with IDN or not. This defaults to set, for backward compatibility. Rename the use_idn option to idn_decode, since that more properly reflects its purpose.
2015-11-24Rewrite address local-to-intl conversion functions.Kevin McCarthy
This is patch 2 of 4 implementing support for SMTPUTF8 (RFC 6531). Perform charset conversion from local to UTF-8 for both the user and domain parts of the address. If IDN is enabled and the options (added in the next patch) are turned on, encode/decode the domain part. Use the intl_checked and is_intl status bits to record the intl/local status of the ADDRESS mailbox part.
2015-11-24Rename idna functions and bits for smtputf8 changes.Kevin McCarthy
This is patch 1 of 4 implementing support for SMTPUTF8 (RFC 6531). Change mutt_idna.c to be always compiled. Remove the stub functions in mutt_idna.h. Instead, put #ifdefs around the idna function calls. The conversion functions will be fixed up in the next patch. Rename the conversion functions to mutt_addrlist_to_intl() and mutt_env_to_intl(). Rename the ADDRESS idna status bits to "intl" status bits.
2009-03-28Make IDNA code more readableThomas Roessler
2009-01-04Update copyrights. Closes #3016.Brendan Cully
I went through the logs of each file with a copyright header and updated the years for the authors in the headers for any non-comment changes they introduced. What a pain!
2008-10-28Make some functions static.Emanuele Giaquinta
2008-10-07Clean up with/without-idn handlingBrendan Cully
2008-10-07Build no-op versions of new IDN functions if IDN is unavailable.Brendan Cully
Closes #3122, #3123.
2008-09-17sorting efficiencyThomas Roessler
2007-03-06Remove buggy usage of M_ICONV_HOOK_TO flag in mutt_idna.c:mutt_idna_to_local().Alain Bench
Wipe unwanted code depending on M_ICONV_HOOK_TO in charset.c:mutt_iconv_open(). Totally wipe M_ICONV_HOOK_TO symbol. Remove misusages of M_ICONV_HOOK_FROM flag in: - crypt-gpgme.c:print_utf8(). - mutt_idna.c:mutt_idna_to_local() and mutt_local_to_idna(). - pgp.c:pgp_traditional_encryptsign(). Document usage policy of M_ICONV_HOOK_FROM flag. Cosmetic downcasing of some constant charset names (utf-8, euc-jp) for consistency. Correction of a typo in the "iso8859-5" charset name.
2006-05-18Avoid safe_free() usage and add security checksRocco Rutte
Add checks to check_sec.sh for memory functions. These include a check for use of safe_free() instead of FREE() and a check whether FREE(&...) is used. For the former, __SAFE_FREE_CHECKED__ is to be used, for the latter __FREE_CHECKED__ to avoid messages from check_sec.sh
2005-10-31Fix the underlying problem behind mutt/2107.Thomas Roessler
2005-09-17Gah, forgot the zip code when updating the FSF address...Brendan Cully
2005-09-17Update FSF address (via sed, I hope nothing got mangled). Closes: #2071.Brendan Cully
2005-02-08Make IDN decoding optional.TAKAHASHI Tamotsu
2005-02-03Add config.h to the top of every C file that could possibly want it.Brendan Cully
Remove it from mutt.h
2003-11-12Fix IDN API incompatibility problems.Thomas Roessler
2003-09-19As the ones of you who compile with new gcc's probably have noticed,Mads Martin Joergensen
there's a lot of type-punning in Mutt. With help from Philipp Thomas, I've fixed all I could find in CVS (please double-check, one might have slipped through the cracks), I can make one for 1.4 CVS branch as well if wanted.
2003-04-08Try to catch a couple of cases in which parameters for malloc callsThomas Roessler
could overflow. Thanks to Timo Sirainen for the heads-up.
2003-03-18(mutt_addr_for_display): Fix memory leak. `user' and `domain'Andrew W. Nosenko
buffers was never deallocated. (mbox_to_udomain): Fix memory leak. `scratch' buffer was not deallocated when `mbx' doesn't contain '@'. Also rewritten for allocating memory only when needed and only how many as needed.
2003-03-07It seems like libidn doesn't like to translate NULL pointers.Thomas Roessler
2003-03-05Fix tlr's pre-processor screw-up.Andrew W. Nosenko
2003-03-04Unset UseSTD3ASCIIRules, and set AllowUnassigned. (Just readingThomas Roessler
some standards.)
2003-03-03IDN support for e-mail messages. Things should work automagicallyThomas Roessler
once you have the GNU IDN library available from ftp://alpha.gnu.org/pub/gnu/libidn/ installed. For IDN's which can't be losslessly recoded to your local character set, mutt should automatically fall back to using the ASCII representation. There's probably a considerable number of bugs in this, and the code may, at this point, not even compile on machines without libidn. Will start working on that ASAP.