[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Mailutils branch, master, updated. release-2.2-422-gbad3c6c
From: |
Sergey Poznyakoff |
Subject: |
[SCM] GNU Mailutils branch, master, updated. release-2.2-422-gbad3c6c |
Date: |
Fri, 04 Nov 2011 10:22:23 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=bad3c6c3a982f65af0fe137d1e5b7a98d13bb9d5
The branch, master has been updated
via bad3c6c3a982f65af0fe137d1e5b7a98d13bb9d5 (commit)
via 325c864eb1b88ac73c39ca3681a02f5194021806 (commit)
from 4fe85f71cba8d7063f30a4b45fc0cc2f557f8681 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bad3c6c3a982f65af0fe137d1e5b7a98d13bb9d5
Author: Sergey Poznyakoff <address@hidden>
Date: Fri Nov 4 12:19:46 2011 +0200
Implement error_string method in TLS streams.
* include/mailutils/sys/tls-stream.h (_mu_tls_stream_s): Remove.
* libmailutils/diag/errors (MU_ERR_BAD_RESUMPTION): Remove. Use EAGAIN
instead.
(MU_ERR_DISABLED): New error code.
* libmu_auth/tls.c (_tls_server_open): Return MU_ERR_DISABLED
when needed.
(_mu_tls_stream_create): Implement error_string method.
* libproto/maildir/mbox.c (maildir_msg_init): Fix return value.
commit 325c864eb1b88ac73c39ca3681a02f5194021806
Author: Sergey Poznyakoff <address@hidden>
Date: Fri Nov 4 11:40:20 2011 +0200
Fix TLS usage.
Remove --tls option. Make TLS stream open methods call mu_init_tls_libs.
It is now not necessary to call this function explicitly, unless the
application wishes to ensure TLS is initialized (e.g. pop3d or imap4d).
* include/mailutils/libargp.h (mu_tls_cmdline): Remove.
* libmu_argp/tls.c
* libmu_argp/Makefile.am (libmu_argp_a_SOURCES): Remove tls.c
* libmu_argp/cmdline.c (all_cmdline_capa): Remove tls.c
* libmu_auth/tls.c [WITH_TLS] (mu_tls_module_config): Enable by default.
(mu_check_tls_environment): Return 0 if TLS is disabled.
(mu_init_tls_libs): Always call gnutls_global_init, otherwise any call
to TLS library (especially, handshake) can produce a coredump.
* libmu_cfg/tls.c: Fix description string for tls.enable.
* mh/mh_init.c (mh_init): Remove call to mu_init_tls_libs, now unnecessary.
* python/libmu_py/registrar.c: Likewise.
* testsuite/smtpsend.c: Likewise.
-----------------------------------------------------------------------
Summary of changes:
include/mailutils/libargp.h | 1 -
include/mailutils/sys/tls-stream.h | 9 ----
libmailutils/diag/errors | 2 +-
libmu_argp/Makefile.am | 3 +-
libmu_argp/cmdline.c | 1 -
libmu_argp/tls.c | 74 ------------------------------------
libmu_auth/tls.c | 36 ++++++++++++++---
libmu_cfg/tls.c | 2 +-
libproto/maildir/mbox.c | 2 +-
mh/mh_init.c | 3 -
mu/pop.c | 2 +-
python/libmu_py/registrar.c | 5 --
testsuite/smtpsend.c | 3 -
13 files changed, 34 insertions(+), 109 deletions(-)
delete mode 100644 libmu_argp/tls.c
diff --git a/include/mailutils/libargp.h b/include/mailutils/libargp.h
index 5412d27..00b56d0 100644
--- a/include/mailutils/libargp.h
+++ b/include/mailutils/libargp.h
@@ -56,7 +56,6 @@ extern struct mu_cmdline_capa mu_debug_cmdline;
extern struct mu_cmdline_capa mu_pam_cmdline;
extern struct mu_cmdline_capa mu_gsasl_cmdline;
-extern struct mu_cmdline_capa mu_tls_cmdline;
extern struct mu_cmdline_capa mu_radius_cmdline;
extern struct mu_cmdline_capa mu_sql_cmdline;
extern struct mu_cmdline_capa mu_virtdomain_cmdline;
diff --git a/include/mailutils/sys/tls-stream.h
b/include/mailutils/sys/tls-stream.h
index 4c4abc9..bc885e4 100644
--- a/include/mailutils/sys/tls-stream.h
+++ b/include/mailutils/sys/tls-stream.h
@@ -45,13 +45,4 @@ struct _mu_tls_stream
mu_stream_t transport[2];
};
-struct _mu_tls_stream_s
-{
- struct _mu_stream stream;
- enum _mu_tls_stream_state state;
- gnutls_session session;
- int tls_err;
- mu_stream_t transport;
-};
-
#endif
diff --git a/libmailutils/diag/errors b/libmailutils/diag/errors
index 5b88ef0..6e54fad 100644
--- a/libmailutils/diag/errors
+++ b/libmailutils/diag/errors
@@ -45,7 +45,6 @@ MU_ERR_LOCK_EXT_KILLED _("External locker killed")
MU_ERR_NO_SUCH_USER _("No such user name")
MU_ERR_GETHOSTBYNAME _("DNS name resolution failed")
-MU_ERR_BAD_RESUMPTION _("State busy must resume operation")
MU_ERR_MAILER_BAD_FROM _("Not a valid sender address")
MU_ERR_MAILER_BAD_TO _("Not a valid recipient address")
MU_ERR_MAILER_NO_RCPT_TO _("No recipient addresses found")
@@ -123,3 +122,4 @@ MU_ERR_PERM_LINKED_WRDIR _("Linked file in a writable
directory")
MU_ERR_PERM_DIR_IWGRP _("File in group writable directory")
MU_ERR_PERM_DIR_IWOTH _("File in world writable directory")
+MU_ERR_DISABLED _("Requested feature disabled in configuration")
diff --git a/libmu_argp/Makefile.am b/libmu_argp/Makefile.am
index 0703993..6714949 100644
--- a/libmu_argp/Makefile.am
+++ b/libmu_argp/Makefile.am
@@ -30,6 +30,5 @@ libmu_argp_a_SOURCES =\
common.c\
mu_argp.c\
muinit.c\
- sieve.c\
- tls.c
+ sieve.c
diff --git a/libmu_argp/cmdline.c b/libmu_argp/cmdline.c
index 410317a..d478007 100644
--- a/libmu_argp/cmdline.c
+++ b/libmu_argp/cmdline.c
@@ -27,7 +27,6 @@ static struct mu_cmdline_capa *all_cmdline_capa[] = {
&mu_logging_cmdline,
&mu_mailer_cmdline,
&mu_debug_cmdline,
- &mu_tls_cmdline,
&mu_sieve_cmdline,
NULL
};
diff --git a/libmu_argp/tls.c b/libmu_argp/tls.c
deleted file mode 100644
index fdd1b3f..0000000
--- a/libmu_argp/tls.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "cmdline.h"
-
-enum {
- OPT_TLS = 256,
-};
-
-static struct argp_option _tls_argp_options[] = {
- {"tls", OPT_TLS, N_("BOOL"), OPTION_ARG_OPTIONAL,
- N_("enable TLS support") },
- {NULL, 0, NULL, 0, NULL, 0}
-};
-
-static error_t
-_tls_argp_parser (int key, char *arg, struct argp_state *state)
-{
- static mu_list_t lst;
-
- switch (key)
- {
- case OPT_TLS:
- mu_argp_node_list_new (lst, "enable", arg ? arg : "yes");
- break;
-
- case ARGP_KEY_INIT:
- mu_argp_node_list_init (&lst);
- break;
-
- case ARGP_KEY_FINI:
- mu_argp_node_list_finish (lst, "tls", NULL);
- break;
-
- default:
- return ARGP_ERR_UNKNOWN;
- }
- return 0;
-}
-
-static struct argp _tls_argp = {
- _tls_argp_options,
- _tls_argp_parser
-};
-
-static struct argp_child _tls_argp_child = {
- &_tls_argp,
- 0,
- NULL,
- 0
-};
-
-struct mu_cmdline_capa mu_tls_cmdline = {
- "tls", &_tls_argp_child
-};
-
diff --git a/libmu_auth/tls.c b/libmu_auth/tls.c
index b225921..054fb92 100644
--- a/libmu_auth/tls.c
+++ b/libmu_auth/tls.c
@@ -35,7 +35,13 @@
#include <mailutils/errno.h>
#include <mailutils/util.h>
-struct mu_tls_module_config mu_tls_module_config;
+struct mu_tls_module_config mu_tls_module_config = {
+#ifdef WITH_TLS
+ 1 /* enable by default */
+#else
+ 0
+#endif
+};
int
mu_tls_module_init (enum mu_gocs_op op, void *data)
@@ -70,6 +76,8 @@ static gnutls_certificate_server_credentials x509_cred;
int
mu_check_tls_environment (void)
{
+ if (!mu_tls_module_config.enable)
+ return 0;
if (mu_tls_module_config.ssl_cert && mu_tls_module_config.ssl_key)
{
int rc = mu_file_safety_check (mu_tls_module_config.ssl_cert,
@@ -120,7 +128,7 @@ _mu_gtls_logger(int level, const char *text)
int
mu_init_tls_libs (void)
{
- if (mu_tls_module_config.enable && !mu_tls_enable)
+ if (!mu_tls_enable)
mu_tls_enable = !gnutls_global_init (); /* Returns 1 on success */
#ifdef DEBUG_TLS
gnutls_global_set_log_function (_mu_gtls_logger);
@@ -319,8 +327,6 @@ _mu_tls_io_stream_create (mu_stream_t *pstream,
sp->stream.close = _tls_io_close;
sp->stream.done = _tls_io_done;
sp->stream.ctl = _tls_io_ioctl;
- /* FIXME:
- sp->stream.error_string = _tls_error_string;*/
mu_stream_ref (transport);
sp->transport = transport;
@@ -354,7 +360,8 @@ _tls_stream_push (gnutls_transport_ptr fd, const void *buf,
size_t size)
rc = mu_stream_write (stream, buf, size, &size);
if (rc)
{
- mu_error ("_tls_stream_push: %s", mu_strerror (rc)); /* FIXME */
+ mu_error ("_tls_stream_push: %s",
+ mu_stream_strerror (stream, rc)); /* FIXME */
return -1;
}
@@ -370,9 +377,13 @@ _tls_server_open (mu_stream_t stream)
int rc = 0;
mu_transport_t transport[2];
+ if (!mu_tls_module_config.enable)
+ return MU_ERR_DISABLED;
if (!stream || sp->state != state_init)
return EINVAL;
+ mu_init_tls_libs ();
+
gnutls_certificate_allocate_credentials (&x509_cred);
if (mu_tls_module_config.ssl_cafile)
@@ -473,6 +484,7 @@ _tls_client_open (mu_stream_t stream)
/* FALLTHROUGH */
case state_init:
+ mu_init_tls_libs ();
prepare_client_session (stream);
rc = gnutls_handshake (sp->session);
if (rc < 0)
@@ -630,6 +642,17 @@ _tls_done (struct _mu_stream *stream)
mu_stream_destroy (&sp->transport[1]);
}
+static const char *
+_tls_error_string (struct _mu_stream *stream, int rc)
+{
+ if (rc == EIO)
+ {
+ struct _mu_tls_stream *sp = (struct _mu_tls_stream *) stream;
+ return gnutls_strerror (sp->tls_err);
+ }
+ return mu_strerror (rc);
+}
+
static int
_mu_tls_stream_create (mu_stream_t *pstream,
int (*openfn) (mu_stream_t stream),
@@ -652,8 +675,7 @@ _mu_tls_stream_create (mu_stream_t *pstream,
sp->stream.done = _tls_done;
sp->stream.ctl = _tls_ioctl;
sp->stream.wait = _tls_wait;
- /* FIXME:
- sp->stream.error_string = _tls_error_string;*/
+ sp->stream.error_string = _tls_error_string;
mu_stream_set_buffer (strin, mu_buffer_none, 0);
mu_stream_set_buffer (strout, mu_buffer_none, 0);
diff --git a/libmu_cfg/tls.c b/libmu_cfg/tls.c
index c40586b..d659189 100644
--- a/libmu_cfg/tls.c
+++ b/libmu_cfg/tls.c
@@ -77,7 +77,7 @@ cb_safety_checks (void *data, mu_config_value_t *arg)
static struct mu_cfg_param mu_tls_param[] = {
{ "enable", mu_cfg_bool, &tls_settings.enable, 0, NULL,
- N_("Enable client TLS encryption.") },
+ N_("Enable TLS encryption.") },
{ "ssl-cert", mu_cfg_string, &tls_settings.ssl_cert, 0, NULL,
N_("Specify SSL certificate file."),
N_("file") },
diff --git a/libproto/maildir/mbox.c b/libproto/maildir/mbox.c
index 298bdfd..cbdc099 100644
--- a/libproto/maildir/mbox.c
+++ b/libproto/maildir/mbox.c
@@ -478,7 +478,7 @@ maildir_msg_init (struct _amd_data *amd, struct
_amd_message *amm)
}
free (fname);
free (name);
- return MU_ERR_BAD_RESUMPTION;
+ return EAGAIN;
}
static int
diff --git a/mh/mh_init.c b/mh/mh_init.c
index 7d44c90..d89a05d 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -47,9 +47,6 @@ mh_init ()
/* Register all mailbox and mailer formats */
mu_register_all_formats ();
-#ifdef WITH_TLS
- mu_init_tls_libs ();
-#endif
/* Read user's profile */
mh_read_profile ();
diff --git a/mu/pop.c b/mu/pop.c
index b0d7128..088ebfe 100644
--- a/mu/pop.c
+++ b/mu/pop.c
@@ -677,7 +677,7 @@ mutool_pop (int argc, char **argv)
if (argp_parse (&pop_argp, argc, argv, ARGP_IN_ORDER, &index, NULL))
return 1;
-
+
argc -= index;
argv += index;
diff --git a/python/libmu_py/registrar.c b/python/libmu_py/registrar.c
index 0e898bf..cc73646 100644
--- a/python/libmu_py/registrar.c
+++ b/python/libmu_py/registrar.c
@@ -131,9 +131,4 @@ _mu_py_attach_registrar ()
mu_registrar_record (MU_DEFAULT_RECORD);
mu_registrar_set_default_record (MU_DEFAULT_RECORD);
-
-#ifdef WITH_TLS
- mu_init_tls_libs ();
-#endif /* WITH_TLS */
-
}
diff --git a/testsuite/smtpsend.c b/testsuite/smtpsend.c
index 2b0d91a..7eaa670 100644
--- a/testsuite/smtpsend.c
+++ b/testsuite/smtpsend.c
@@ -103,9 +103,6 @@ main (int argc, char **argv)
mu_set_program_name (argv[0]);
mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
-#ifdef WITH_TLS
- mu_init_tls_libs ();
-#endif
if (argc < 2)
usage ();
hooks/post-receive
--
GNU Mailutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Mailutils branch, master, updated. release-2.2-422-gbad3c6c,
Sergey Poznyakoff <=