Bug#644992: mutt: Cannot use IPv6 address in IMAP/POP3 URL

2016-09-04 Thread Antonio Radici
Patch added in git, it will be part of 1.7.0-2. Thanks to Evgeni!



Bug#644992: mutt: Cannot use IPv6 address in IMAP/POP3 URL

2016-08-29 Thread Antonio Radici
Control: tag -1 +patch pending

This patch can be included in the next release.



Bug#644992: mutt: Cannot use IPv6 address in IMAP/POP3 URL

2014-03-10 Thread Evgeni Golov
Hi,

On Tue, Oct 11, 2011 at 04:28:31PM +0200, Roland Rosenfeld wrote:

> mutt -fimap://user:pass@'[::1]'
> mutt -fpop://user:pass@'[::1]'
> 
> but with this I run into error messages and mutt terminates with the
> following messages:
> 
> imap://user:pass@[::1] is an invalid IMAP path
> pop://user:pass@[::1] is an invalid POP path
> 
> I also tried the same without brackets, but this also fails (as
> expected, because isn't defined whether the last colon is part of the
> IP or the separator of the port number).
> 
> Maybe there is some other syntax expected, but I didn't find a hint in
> the manual...

I could not either, so I cooked a (dirty) patch for that. Attached.

Not tagging patch, as I first want to have some review of it :)

Regards
Evgeni
# HG changeset patch
# User evg...@golov.de
# Date 1394440540 -3600
#  Mon Mar 10 09:35:40 2014 +0100
# Node ID 66fa4d508db0efa22957f260ab6d7b5626f64b42
# Parent  1d8b2c1ec4f49e4d1773b9e7511396d0e27747c6
allow parsing of URIs with IPv6 literal addresses (RFCs 2732 and 3986)

diff -r 1d8b2c1ec4f4 -r 66fa4d508db0 mutt_socket.c
--- a/mutt_socket.c	Sun Mar 09 20:53:51 2014 +0100
+++ b/mutt_socket.c	Mon Mar 10 09:35:40 2014 +0100
@@ -442,6 +442,8 @@
   int fd;
 
   char *host_idna = NULL;
+  char *host = NULL;
+  char *tmp = NULL;
   
 #ifdef HAVE_GETADDRINFO
 /* --- IPv4/6 --- */
@@ -474,10 +476,18 @@
   host_idna = conn->account.host;
 # endif
 
+  if ((host = strchr(host_idna, '[')) && (tmp = strrchr(host_idna, ']')))
+  {
+  *tmp = '\0';
+  host = strchr(host_idna, '[')+1;
+  }
+  else
+host = host_idna;
+
   if (!option(OPTNOCURSES))
 mutt_message (_("Looking up %s..."), conn->account.host);
   
-  rc = getaddrinfo (host_idna, port, &hints, &res);
+  rc = getaddrinfo (host, port, &hints, &res);
 
 # ifdef HAVE_LIBIDN
   FREE (&host_idna);
diff -r 1d8b2c1ec4f4 -r 66fa4d508db0 url.c
--- a/url.c	Sun Mar 09 20:53:51 2014 +0100
+++ b/url.c	Mon Mar 10 09:35:40 2014 +0100
@@ -111,7 +111,7 @@
  *   means no port given. */
 static int ciss_parse_userhost (ciss_url_t *ciss, char *src)
 {
-  char *t, *p;
+  char *t, *p, *v;
 
   ciss->user = NULL;
   ciss->pass = NULL;
@@ -147,7 +147,17 @@
   else
 t = src;
 
-  if ((p = strchr (t, ':')))
+  if ((v = strchr (t, '[')))
+  {
+if (!(v = strrchr (v, ']')))
+{
+  v = t;
+}
+  }
+  else
+v = t;
+
+  if ((p = strchr (v, ':')))
   {
 int t;
 *p++ = '\0';


Bug#644992: mutt: Cannot use IPv6 address in IMAP/POP3 URL

2011-10-11 Thread Roland Rosenfeld
Package: mutt
Version: 1.5.21-4~bpo60+1
Severity: normal
Tags: ipv6

For tests with newly installed servers I usually access IMAP and/or
POP3 Servers directly in the URL like this:

mutt -fimap://user:pass@127.0.0.1 
mutt -fpop://user:pass@127.0.0.1

This works correctly as expected.  Now I tried the same with an IPv6
address like

mutt -fimap://user:pass@'[::1]'
mutt -fpop://user:pass@'[::1]'

but with this I run into error messages and mutt terminates with the
following messages:

imap://user:pass@[::1] is an invalid IMAP path
pop://user:pass@[::1] is an invalid POP path

I also tried the same without brackets, but this also fails (as
expected, because isn't defined whether the last colon is part of the
IP or the separator of the port number).

Maybe there is some other syntax expected, but I didn't find a hint in
the manual...

This isn't a big problem, since entering a hostname in /etc/hosts or
using a correctly configured name services works around the problem.
Anyway for testing purpose it would be a good idea to be able to enter
a plain IPv6 address...

Tscho

Roland

-- Package-specific info:
Mutt 1.5.21 (2010-09-15)
Copyright (C) 1996-2009 Michael R. Elkins and others.
Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
Mutt is free software, and you are welcome to redistribute it
under certain conditions; type `mutt -vv' for details.

System: Linux 2.6.32-5-686 (i686)
ncurses: ncurses 5.7.20100313 (compiled with 5.7)
libidn: 1.15 (compiled with 1.15)
hcache backend: tokyocabinet 1.4.37
Compile options:
-DOMAIN
+DEBUG
-HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE  +USE_FCNTL  -USE_FLOCK   
+USE_POP  +USE_IMAP  +USE_SMTP  
-USE_SSL_OPENSSL  +USE_SSL_GNUTLS  +USE_SASL  +USE_GSS  +HAVE_GETADDRINFO  
+HAVE_REGCOMP  -USE_GNU_REGEX  
+HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET  
+HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM  
+CRYPT_BACKEND_CLASSIC_PGP  +CRYPT_BACKEND_CLASSIC_SMIME  +CRYPT_BACKEND_GPGME  
-EXACT_ADDRESS  -SUN_ATTACHMENT  
+ENABLE_NLS  -LOCALES_HACK  +COMPRESSED  +HAVE_WC_FUNCS  +HAVE_LANGINFO_CODESET 
 +HAVE_LANGINFO_YESEXPR  
+HAVE_ICONV  -ICONV_NONTRANS  +HAVE_LIBIDN  +HAVE_GETSID  +USE_HCACHE  
-ISPELL
SENDMAIL="/usr/sbin/sendmail"
MAILPATH="/var/mail"
PKGDATADIR="/usr/share/mutt"
SYSCONFDIR="/etc"
EXECSHELL="/bin/sh"
MIXMASTER="mixmaster"
To contact the developers, please mail to .
To report a bug, please visit http://bugs.mutt.org/.

misc/am-maintainer-mode
features/ifdef
features/xtitles
features/trash-folder
features/purge-message
features/imap_fast_trash
features/sensible_browser_position
features-old/patch-1.5.4.vk.pgp_verbose_mime
features/compressed-folders
features/compressed-folders.debian
debian-specific/Muttrc
debian-specific/Md.etc_mailname_gethostbyname.diff
debian-specific/use_usr_bin_editor.diff
debian-specific/correct_docdir_in_man_page.diff
debian-specific/dont_document_not_present_features.diff
debian-specific/document_debian_defaults
debian-specific/assumed_charset-compat
debian-specific/467432-write_bcc.patch
debian-specific/566076-build_doc_adjustments.patch
misc/define-pgp_getkeys_command.diff
misc/gpg.rc-paths
misc/smime.rc
upstream/531430-imapuser.patch
upstream/537818-emptycharset.patch
upstream/543467-thread-segfault.patch
upstream/542817-smimekeys-tmpdir.patch
upstream/537694-segv-imap-headers.patch
upstream/548577-gpgme-1.2.patch
upstream/553321-ansi-escape-segfault.patch
upstream/568295-references.patch
upstream/547980-smime_keys-chaining.patch
upstream/528233-readonly-open.patch
upstream/228671-pipe-mime.patch
upstream/383769-score-match.patch
upstream/578087-header-strchr.patch
upstream/603288-split-fetches.patch
upstream/537061-dont-recode-saved-attachments.patch
upstream/608706-fix-spelling-errors.patch
upstream/620854-pop3-segfault.patch
upstream/path_max
mutt.org

-- System Information:
Debian Release: 6.0.3
  APT prefers stable
  APT policy: (500, 'stable'), (60, 'testing'), (50, 'unstable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages mutt depends on:
ii  libc6   2.11.2-10Embedded GNU C Library: Shared lib
ii  libcomerr2  1.41.12-4stable1 common error description library
ii  libgnutls26 2.8.6-1  the GNU TLS library - runtime libr
ii  libgpg-error0   1.6-1library for common error values an
ii  libgpgme11  1.2.0-1.2GPGME - GnuPG Made Easy
ii  libgssapi-krb5-21.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries - k
ii  libidn111.15-2   GNU Libidn library, implementation
ii  libk5crypto31.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries - C
ii  libkrb5-3   1.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries
ii  libncursesw55.7+20100313-5   shared libraries for terminal hand
ii  libsasl2