1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00

Merge pull request #6133 from wbx-github/idn_config

make IDN support conditional
This commit is contained in:
Lennart Poettering 2017-06-16 22:06:48 +02:00 committed by GitHub
commit 117e610075
4 changed files with 21 additions and 2 deletions

View File

@ -1049,6 +1049,15 @@ if test "$have_libidn2" != "yes"; then
fi
AM_CONDITIONAL(HAVE_LIBIDN, [test "$have_libidn" = "yes"])
# ------------------------------------------------------------------------------
have_idn=no
AC_ARG_ENABLE(idn, AS_HELP_STRING([--disable-idn], [disable IDN when printing host names]))
if test "x$enable_idn" != "xno"; then
have_idn=yes
AC_DEFINE(ENABLE_IDN, [1], [IDN is enabled])
fi
AM_CONDITIONAL(ENABLE_IDN, [test "$have_idn" = "yes"])
# ------------------------------------------------------------------------------
have_libiptc=no
AC_ARG_ENABLE(libiptc, AS_HELP_STRING([--disable-libiptc], [disable optional LIBIPTC support]))
@ -1742,6 +1751,7 @@ AC_MSG_RESULT([
libcurl: ${have_libcurl}
libidn2: ${have_libidn2}
libidn: ${have_libidn}
IDN: ${have_idn}
libiptc: ${have_libiptc}
ELFUTILS: ${have_elfutils}
binfmt: ${have_binfmt}

View File

@ -1009,6 +1009,7 @@ foreach pair : [['utmp', 'HAVE_UTMP'],
['ima', 'HAVE_IMA'],
['smack', 'HAVE_SMACK'],
['gshadow', 'ENABLE_GSHADOW'],
['idn', 'ENABLE_IDN'],
]
if get_option(pair[0])
@ -2448,6 +2449,7 @@ foreach tuple : [
['microhttpd'],
['gnutls'],
['libcurl'],
['idn'],
['libidn2'],
['libidn'],
['libiptc'],

View File

@ -197,6 +197,8 @@ option('libcryptsetup', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libcryptsetup support')
option('libcurl', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libcurl support')
option('idn', type : 'boolean',
description : 'use IDN when printing host names')
option('libidn2', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'libidn2 support')
option('libidn', type : 'combo', choices : ['auto', 'true', 'false'],

View File

@ -48,6 +48,12 @@
#include "utf8.h"
#include "util.h"
#ifdef ENABLE_IDN
# define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES)
#else
# define IDN_FLAGS 0
#endif
int socket_address_parse(SocketAddress *a, const char *s) {
char *e, *n;
unsigned u;
@ -723,8 +729,7 @@ int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret)
assert(_ret);
r = getnameinfo(&sa->sa, salen, host, sizeof(host), NULL, 0,
NI_IDN|NI_IDN_USE_STD3_ASCII_RULES);
r = getnameinfo(&sa->sa, salen, host, sizeof(host), NULL, 0, IDN_FLAGS);
if (r != 0) {
int saved_errno = errno;