diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-03-30 00:49:43 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-03-30 15:51:47 +0300 |
commit | adca074d616ac562095a92e01f2b181e6d3593c8 (patch) | |
tree | f4c11a1c11fcb137cfada7643e6f284465a75c16 | |
parent | 827cb66a4c639139c3f11c7af26aa5149f25a7e0 (diff) | |
download | mailutils-adca074d616ac562095a92e01f2b181e6d3593c8.tar.gz mailutils-adca074d616ac562095a92e01f2b181e6d3593c8.tar.bz2 |
Implement IPv6 support.
* am/ipv6.m4: New file.
* examples/sa.c: New file.
* include/mailutils/cidr.h: New file.
* include/mailutils/sockaddr.h: New file.
* libmailutils/cidr/Makefile.am: New file.
* libmailutils/cidr/fromsa.c: New file.
* libmailutils/cidr/fromstr.c: New file.
* libmailutils/cidr/match.c: New file.
* libmailutils/cidr/tosa.c: New file.
* libmailutils/cidr/tostr.c: New file.
* libmailutils/sockaddr/Makefile.am: New file.
* libmailutils/sockaddr/copy.c: New file.
* libmailutils/sockaddr/create.c: New file.
* libmailutils/sockaddr/free.c: New file.
* libmailutils/sockaddr/fromnode.c: New file.
* libmailutils/sockaddr/insert.c: New file.
* libmailutils/sockaddr/ipaddr.c: New file.
* libmailutils/sockaddr/str.c: New file.
* libmailutils/sockaddr/unlink.c: New file.
* libmailutils/sockaddr/url.c: New file.
* libmailutils/tests/cidr.c: New file.
* configure.ac: Call MU_ENABLE_IPV6.
Build libmailutils/sockaddr and libmailutils/cidr.
* examples/.gitignore: Add mblconv and sa
* examples/Makefile.am: (noinst_PROGRAMS): Add sa.
* examples/aclck.c: Use new ACL API.
* examples/echosrv.c: Use new mserv API.
* include/mailutils/Makefile.am (pkginclude_HEADERS): Add cidr.h
and sockaddr.h
* include/mailutils/acl.h (mu_acl_append, mu_acl_prepend)
(mu_acl_insert): Change signatures.
* include/mailutils/debug.h (mu_sockaddr_to_str): Remove proto.
* include/mailutils/mailutils.h: Include cidr.h and sockaddr.h
* include/mailutils/server.h (mu_ip_server_create): Change signature.
(mu_ip_server_get_sockaddr): Likewise.
(mu_m_server_set_default_address)
(mu_m_server_get_default_address): Remove.
* include/mailutils/stream.h (mu_tcp_stream_create_from_sa): New proto.
* include/mailutils/types.hin (mu_cidr, mu_sockaddr): New structs.
* include/mailutils/url.h (MU_URL_IPV6): New flag.
(MU_URL_PARSE_DSLASH_OPTIONAL): New parse flag.
* libmailutils/Makefile.am: Descend into cidr and sockaddr. Link in
libcidr and libsockaddr.
* libmailutils/diag/debug.c (mu_debug_log_begin): Flush mu_strerr.
* libmailutils/diag/errors (MU_ERR_NONAME)
(MU_ERR_BADFLAGS,MU_ERR_SOCKTYPE)
(MU_ERR_FAMILY,MU_ERR_SERVICE): New errors.
* libmailutils/server/acl.c: Rewrite API using mu_cidr.
* libmailutils/server/ipsrv.c: Rewrite AI using mu_sockaddr.
* libmailutils/server/msrv.c: Likewise.
* libmailutils/stream/tcp.c: Likewise.
* libmailutils/tests/.gitignore: Add cidr.
* libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add cidr.
* libmailutils/tests/url-parse.c: Support command line options
to tune the parsing.
* libmailutils/tests/url.at: Pass options to url-parse.
* libmailutils/url/create.c (getkn): Return meaningful error code.
(_mu_url_ctx_parse_host): Accept IPv6 addresses. Set the MU_URL_IPV6
flag if one is given.
(_mu_url_ctx_parse): Unless MU_URL_PARSE_DSLASH_OPTIONAL flag is
given, request :// after scheme part.
(mu_url_create): Add MU_URL_PARSE_DSLASH_OPTIONAL flag.
* libmu_cfg/acl.c: Use new ACL API.
* mu/acl.c: Likewise.
* libproto/mailer/smtp.c (smtp_open): Use mu_tcp_stream_create_from_sa
* libproto/pop/mbox.c (pop_open): Likewise.
* mu/imap.c (com_connect): Likewise.
* mu/pop.c (com_connect): Likewise.
* testsuite/smtpsend.c (main): Likewise.
53 files changed, 2416 insertions, 980 deletions
diff --git a/am/ipv6.m4 b/am/ipv6.m4 new file mode 100644 index 000000000..2357314b9 --- /dev/null +++ b/am/ipv6.m4 | |||
@@ -0,0 +1,56 @@ | |||
1 | dnl This file is part of GNU Mailutils. -*- autoconf -*- | ||
2 | dnl Copyright (C) 2011 Free Software Foundation, Inc. | ||
3 | dnl | ||
4 | dnl GNU Mailutils is free software; you can redistribute it and/or modify | ||
5 | dnl it under the terms of the GNU General Public License as published by | ||
6 | dnl the Free Software Foundation; either version 3 of the License, or | ||
7 | dnl (at your option) any later version. | ||
8 | dnl | ||
9 | dnl GNU Mailutils is distributed in the hope that it will be useful, | ||
10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | dnl GNU General Public License for more details. | ||
13 | dnl | ||
14 | dnl You should have received a copy of the GNU General Public License | ||
15 | dnl along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AC_DEFUN([MU_ENABLE_IPV6], | ||
18 | [AC_ARG_ENABLE(ipv6, | ||
19 | [AC_HELP_STRING([--enable-ipv6], [enable IPv6 support])], | ||
20 | [status_ipv6=$enableval], | ||
21 | [status_ipv6=maybe]) | ||
22 | |||
23 | if test $status_ipv6 != no; then | ||
24 | working_ipv6=no | ||
25 | AC_EGREP_CPP(MAILUTILS_AF_INET6_DEFINED,[ | ||
26 | #include <sys/socket.h> | ||
27 | #if defined(AF_INET6) | ||
28 | MAILUTILS_AF_INET6_DEFINED | ||
29 | #endif | ||
30 | ],[working_ipv6=yes]) | ||
31 | |||
32 | AC_CHECK_TYPE([struct sockaddr_storage], | ||
33 | [working_ipv6=yes], [working_ipv6=no], | ||
34 | [#include <sys/socket.h>]) | ||
35 | AC_CHECK_TYPE([struct sockaddr_in6], | ||
36 | [working_ipv6=yes], [working_ipv6=no], | ||
37 | [#include <sys/types.h> | ||
38 | #include <netinet/in.h>]) | ||
39 | AC_CHECK_TYPE([struct addrinfo], | ||
40 | [working_ipv6=yes], [working_ipv6=no], | ||
41 | [#include <netdb.h>]) | ||
42 | AC_CHECK_FUNC([getnameinfo], | ||
43 | [working_ipv6=yes], [working_ipv6=no], | ||
44 | [#include <netdb.h>]) | ||
45 | |||
46 | if test $working_ipv6 = no; then | ||
47 | if test $status_ipv6 = yes; then | ||
48 | AC_MSG_ERROR([IPv6 support is required but not available]) | ||
49 | fi | ||
50 | fi | ||
51 | status_ipv6=$working_ipv6 | ||
52 | if test $status_ipv6 = yes; then | ||
53 | AC_DEFINE_UNQUOTED([MAILUTILS_IPV6],1, | ||
54 | [Define to 1 if IPv6 support is enabled]) | ||
55 | fi | ||
56 | fi]) \ No newline at end of file | ||
diff --git a/configure.ac b/configure.ac index e03a4c3b3..2edb49459 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -541,6 +541,10 @@ AH_BOTTOM([ | |||
541 | ]) | 541 | ]) |
542 | 542 | ||
543 | 543 | ||
544 | # IPv6 support | ||
545 | MU_ENABLE_IPV6 | ||
546 | |||
547 | |||
544 | ## FriBidi support | 548 | ## FriBidi support |
545 | 549 | ||
546 | AC_CHECK_FUNCS(wcwidth) | 550 | AC_CHECK_FUNCS(wcwidth) |
@@ -1285,6 +1289,8 @@ LDAP support .................. $status_ldap | |||
1285 | Radius support ................ $status_radius | 1289 | Radius support ................ $status_radius |
1286 | Support for virtual domains ... $status_virtual_domains | 1290 | Support for virtual domains ... $status_virtual_domains |
1287 | 1291 | ||
1292 | IPv6 support .................. $status_ipv6 | ||
1293 | |||
1288 | Interfaces: | 1294 | Interfaces: |
1289 | 1295 | ||
1290 | Guile ......................... $status_guile | 1296 | Guile ......................... $status_guile |
@@ -1332,6 +1338,7 @@ status_mh=$mu_cv_enable_mh | |||
1332 | status_maildir=$mu_cv_enable_maildir | 1338 | status_maildir=$mu_cv_enable_maildir |
1333 | status_smtp=$mu_cv_enable_smtp | 1339 | status_smtp=$mu_cv_enable_smtp |
1334 | status_sendmail=$mu_cv_enable_sendmail | 1340 | status_sendmail=$mu_cv_enable_sendmail |
1341 | status_ipv6=$status_ipv6 | ||
1335 | ]) | 1342 | ]) |
1336 | 1343 | ||
1337 | dnl Output Makefiles | 1344 | dnl Output Makefiles |
@@ -1382,6 +1389,8 @@ AC_CONFIG_FILES([ | |||
1382 | libmailutils/auth/Makefile | 1389 | libmailutils/auth/Makefile |
1383 | libmailutils/base/Makefile | 1390 | libmailutils/base/Makefile |
1384 | libmailutils/address/Makefile | 1391 | libmailutils/address/Makefile |
1392 | libmailutils/sockaddr/Makefile | ||
1393 | libmailutils/cidr/Makefile | ||
1385 | libmailutils/cfg/Makefile | 1394 | libmailutils/cfg/Makefile |
1386 | libmailutils/diag/Makefile | 1395 | libmailutils/diag/Makefile |
1387 | libmailutils/filter/Makefile | 1396 | libmailutils/filter/Makefile |
diff --git a/examples/.gitignore b/examples/.gitignore index af4156be3..890812aae 100644 --- a/examples/.gitignore +++ b/examples/.gitignore | |||
@@ -11,6 +11,7 @@ iconv | |||
11 | listop | 11 | listop |
12 | lsf | 12 | lsf |
13 | mailcap | 13 | mailcap |
14 | mblconv | ||
14 | mimetest | 15 | mimetest |
15 | msg-send | 16 | msg-send |
16 | mta | 17 | mta |
@@ -20,5 +21,6 @@ muemail | |||
20 | murun | 21 | murun |
21 | musocio | 22 | musocio |
22 | nntpclient | 23 | nntpclient |
24 | sa | ||
23 | sfrom | 25 | sfrom |
24 | url-parse | 26 | url-parse |
diff --git a/examples/Makefile.am b/examples/Makefile.am index e22a8d355..9df91ea62 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am | |||
@@ -43,6 +43,7 @@ noinst_PROGRAMS = \ | |||
43 | murun\ | 43 | murun\ |
44 | musocio\ | 44 | musocio\ |
45 | $(NNTPCLIENT)\ | 45 | $(NNTPCLIENT)\ |
46 | sa\ | ||
46 | sfrom | 47 | sfrom |
47 | 48 | ||
48 | EXTRA_PROGRAMS = nntpclient |