Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
mutt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
45
Issues
45
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mutt Project
mutt
Commits
13a2f614
Commit
13a2f614
authored
Apr 09, 2018
by
Matej Muzila
Committed by
Kevin J. McCarthy
Apr 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add libidn2 support
parent
a21fb60e
Pipeline
#20539298
passed with stages
in 25 minutes and 30 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
21 deletions
+94
-21
configure.ac
configure.ac
+55
-0
doc/makedoc-defs.h
doc/makedoc-defs.h
+3
-0
init.h
init.h
+2
-2
main.c
main.c
+12
-1
mutt.h
mutt.h
+1
-1
mutt_idna.c
mutt_idna.c
+10
-10
mutt_idna.h
mutt_idna.h
+6
-2
mutt_socket.c
mutt_socket.c
+4
-4
mutt_ssl.c
mutt_ssl.c
+1
-1
No files found.
configure.ac
View file @
13a2f614
...
...
@@ -1293,6 +1293,25 @@ AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for int
],
[with_idn=auto])
AC_ARG_WITH(idn2, AS_HELP_STRING([--with-idn2=@<:@PFX@:>@],[Use GNU libidn2 for internationalized domain names]),
[
if test "$with_idn2" != "no" ; then
if test "$with_idn" = "auto"; then
with_idn="no"
fi
if test "$with_idn" != "no"; then
AC_MSG_ERROR([Cannot enable IDN and IDN2 support at the same time])
fi
if test "$with_idn2" != "yes" ; then
CPPFLAGS="$CPPFLAGS -I$with_idn2/include"
LDFLAGS="$LDFLAGS -L$with_idn2/lib"
fi
fi
],
[with_idn2=no])
if test "x$with_idn" != "xno"; then
if test "$am_cv_func_iconv" != "yes"; then
if test "$with_idn" != "auto"; then
...
...
@@ -1332,6 +1351,42 @@ if test "x$with_idn" != "xno"; then
fi
fi
dnl idna2
if test "x$with_idn2" != "xno"; then
if test "$am_cv_func_iconv" != "yes"; then
if test "$with_idn2" != "auto"; then
AC_MSG_ERROR([IDN2 requested but iconv is disabled or unavailable])
fi
else
dnl Solaris 11 has /usr/include/idn
have_idn2_h=no
AC_CHECK_HEADERS([idn2.h idn/idn2.h], [
have_idn2_h=yes
break])
mutt_save_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([idn2_check_version], [idn2], [
AC_DEFINE([HAVE_LIBIDN2], 1, [Define to 1 if you have the GNU idn2 library])
MUTTLIBS="$MUTTLIBS $LIBS"
LIBS="$LIBS $LIBICONV"
AC_DEFINE([HAVE_IDNA_TO_UNICODE_8Z8Z])
AC_DEFINE([HAVE_IDNA_TO_ASCII_8Z])
AC_DEFINE([HAVE_IDNA_TO_ASCII_LZ])
])
LIBS="$mutt_save_LIBS"
if test "$with_idn2" != "no"; then
if test "$have_idn2_h" = "no" || test "$ac_cv_search_idn2_check_version" = "no"; then
AC_MSG_ERROR([IDN2 was requested, but libidn2 was not usable on this system])
fi
fi
fi
fi
dnl -- locales --
AC_CHECK_HEADERS(wchar.h)
...
...
doc/makedoc-defs.h
View file @
13a2f614
...
...
@@ -52,6 +52,9 @@
# ifndef HAVE_LIBIDN
# define HAVE_LIBIDN
# endif
# ifndef HAVE_LIBIDN2
# define HAVE_LIBIDN2
# endif
# ifndef HAVE_GETADDRINFO
# define HAVE_GETADDRINFO
# endif
...
...
init.h
View file @
13a2f614
...
...
@@ -1177,7 +1177,7 @@ struct option_t MuttVars[] = {
** .pp
** Also see $$use_domain and $$hidden_host.
*/
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
{
"idn_decode"
,
DT_BOOL
,
R_MENU
,
OPTIDNDECODE
,
1
},
/*
** .pp
...
...
@@ -1192,7 +1192,7 @@ struct option_t MuttVars[] = {
** IDN. Unset this if your SMTP server can handle newer (RFC 6531)
** UTF-8 encoded domains. (IDN only)
*/
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
{
"ignore_linear_white_space"
,
DT_BOOL
,
R_NONE
,
OPTIGNORELWS
,
0
},
/*
** .pp
...
...
main.c
View file @
13a2f614
...
...
@@ -218,6 +218,11 @@ static void show_version (void)
STRINGPREP_VERSION
);
#endif
#ifdef HAVE_LIBIDN2
printf
(
"
\n
libidn2: %s (compiled with %s)"
,
idn2_check_version
(
NULL
),
IDN2_VERSION
);
#endif
#ifdef USE_HCACHE
printf
(
"
\n
hcache backend: %s"
,
mutt_hcache_backend
());
#endif
...
...
@@ -485,7 +490,13 @@ static void show_version (void)
#else
"-HAVE_LIBIDN "
#endif
#if HAVE_LIBIDN2
"+HAVE_LIBIDN2 "
#else
"-HAVE_LIBIDN2 "
#endif
#if HAVE_GETSID
"+HAVE_GETSID "
#else
...
...
mutt.h
View file @
13a2f614
...
...
@@ -492,7 +492,7 @@ enum
OPTUSEDOMAIN
,
OPTUSEFROM
,
OPTUSEGPGAGENT
,
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
OPTIDNDECODE
,
OPTIDNENCODE
,
#endif
...
...
mutt_idna.c
View file @
13a2f614
...
...
@@ -24,7 +24,7 @@
#include "charset.h"
#include "mutt_idna.h"
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
static
int
check_idn
(
char
*
domain
)
{
if
(
!
domain
)
...
...
@@ -41,7 +41,7 @@ static int check_idn (char *domain)
return
0
;
}
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
static
int
mbox_to_udomain
(
const
char
*
mbx
,
char
**
user
,
char
**
domain
)
{
...
...
@@ -90,14 +90,14 @@ static char *intl_to_local (char *orig_user, char *orig_domain, int flags)
char
*
local_user
=
NULL
,
*
local_domain
=
NULL
,
*
mailbox
=
NULL
;
char
*
reversed_user
=
NULL
,
*
reversed_domain
=
NULL
;
char
*
tmp
=
NULL
;
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
int
is_idn_encoded
=
0
;
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
local_user
=
safe_strdup
(
orig_user
);
local_domain
=
safe_strdup
(
orig_domain
);
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
is_idn_encoded
=
check_idn
(
local_domain
);
if
(
is_idn_encoded
&&
option
(
OPTIDNDECODE
))
{
...
...
@@ -106,7 +106,7 @@ static char *intl_to_local (char *orig_user, char *orig_domain, int flags)
mutt_str_replace
(
&
local_domain
,
tmp
);
FREE
(
&
tmp
);
}
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
/* we don't want charset-hook effects, so we set flags to 0 */
if
(
mutt_convert_string
(
&
local_user
,
"utf-8"
,
Charset
,
0
)
==
-
1
)
...
...
@@ -148,7 +148,7 @@ static char *intl_to_local (char *orig_user, char *orig_domain, int flags)
goto
cleanup
;
}
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
/* If the original domain was UTF-8, idna encoding here could
* produce a non-matching domain! Thus we only want to do the
* idna_to_ascii_8z() if the original domain was IDNA encoded.
...
...
@@ -164,7 +164,7 @@ static char *intl_to_local (char *orig_user, char *orig_domain, int flags)
}
mutt_str_replace
(
&
reversed_domain
,
tmp
);
}
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
if
(
ascii_strcasecmp
(
orig_domain
,
reversed_domain
))
{
...
...
@@ -203,14 +203,14 @@ static char *local_to_intl (char *user, char *domain)
if
(
mutt_convert_string
(
&
intl_domain
,
Charset
,
"utf-8"
,
0
)
==
-
1
)
goto
cleanup
;
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
if
(
option
(
OPTIDNENCODE
))
{
if
(
idna_to_ascii_8z
(
intl_domain
,
&
tmp
,
IDNA_ALLOW_UNASSIGNED
)
!=
IDNA_SUCCESS
)
goto
cleanup
;
mutt_str_replace
(
&
intl_domain
,
tmp
);
}
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
mailbox
=
safe_malloc
(
mutt_strlen
(
intl_user
)
+
mutt_strlen
(
intl_domain
)
+
2
);
sprintf
(
mailbox
,
"%s@%s"
,
NONULL
(
intl_user
),
NONULL
(
intl_domain
));
/* __SPRINTF_CHECKED__ */
...
...
mutt_idna.h
View file @
13a2f614
...
...
@@ -26,13 +26,17 @@
#include <idna.h>
#elif defined(HAVE_IDN_IDNA_H)
#include <idn/idna.h>
#elif defined(HAVE_IDN2_H)
#include <idn2.h>
#elif defined(HAVE_IDN_IDN2_H)
#include <idn/idn2.h>
#endif
#define MI_MAY_BE_IRREVERSIBLE (1 << 0)
/* Work around incompatibilities in the libidn API */
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
# if (!defined(HAVE_IDNA_TO_ASCII_8Z) && defined(HAVE_IDNA_TO_ASCII_FROM_UTF8))
# define idna_to_ascii_8z(a,b,c) idna_to_ascii_from_utf8(a,b,(c)&1,((c)&2)?1:0)
# endif
...
...
@@ -42,7 +46,7 @@
# if (!defined(HAVE_IDNA_TO_UNICODE_8Z8Z) && defined(HAVE_IDNA_TO_UNICODE_UTF8_FROM_UTF8))
# define idna_to_unicode_8z8z(a,b,c) idna_to_unicode_utf8_from_utf8(a,b,(c)&1,((c)&2)?1:0)
# endif
#endif
/*
HAVE_LIBIDN
*/
#endif
/*
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
*/
#ifdef HAVE_ICONV
...
...
mutt_socket.c
View file @
13a2f614
...
...
@@ -499,7 +499,7 @@ int raw_socket_open (CONNECTION* conn)
snprintf
(
port
,
sizeof
(
port
),
"%d"
,
conn
->
account
.
port
);
# if
def HAVE_LIBIDN
# if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
if
(
idna_to_ascii_lz
(
conn
->
account
.
host
,
&
host_idna
,
1
)
!=
IDNA_SUCCESS
)
{
mutt_error
(
_
(
"Bad IDN
\"
%s
\"
."
),
conn
->
account
.
host
);
...
...
@@ -514,7 +514,7 @@ int raw_socket_open (CONNECTION* conn)
rc
=
getaddrinfo
(
host_idna
,
port
,
&
hints
,
&
res
);
# if
def HAVE_LIBIDN
# if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
FREE
(
&
host_idna
);
# endif
...
...
@@ -558,7 +558,7 @@ int raw_socket_open (CONNECTION* conn)
sin
.
sin_port
=
htons
(
conn
->
account
.
port
);
sin
.
sin_family
=
AF_INET
;
# if
def HAVE_LIBIDN
# if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
if
(
idna_to_ascii_lz
(
conn
->
account
.
host
,
&
host_idna
,
1
)
!=
IDNA_SUCCESS
)
{
mutt_error
(
_
(
"Bad IDN
\"
%s
\"
."
),
conn
->
account
.
host
);
...
...
@@ -573,7 +573,7 @@ int raw_socket_open (CONNECTION* conn)
he
=
gethostbyname
(
host_idna
);
# if
def HAVE_LIBIDN
# if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
FREE
(
&
host_idna
);
# endif
...
...
mutt_ssl.c
View file @
13a2f614
...
...
@@ -935,7 +935,7 @@ static int check_host (X509 *x509cert, const char *hostname, char *err, size_t e
/* Check if 'hostname' matches the one of the subjectAltName extensions of
* type DNS or the Common Name (CN). */
#if
def HAVE_LIBIDN
#if
defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2)
if
(
idna_to_ascii_lz
(
hostname
,
&
hostname_ascii
,
0
)
!=
IDNA_SUCCESS
)
{
hostname_ascii
=
safe_strdup
(
hostname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment