diff options
author | 2011-11-02 02:56:40 +0000 | |
---|---|---|
committer | 2011-11-02 02:56:40 +0000 | |
commit | 313bd8e727aa8fdcf3fe8267a6d8cbe3bf6fd582 (patch) | |
tree | 8a89b7e4ff12304a53eaa883772c75a9af2a6961 | |
parent | Version bump for dev channel release. (diff) | |
download | gentoo-2-313bd8e727aa8fdcf3fe8267a6d8cbe3bf6fd582.tar.gz gentoo-2-313bd8e727aa8fdcf3fe8267a6d8cbe3bf6fd582.tar.bz2 gentoo-2-313bd8e727aa8fdcf3fe8267a6d8cbe3bf6fd582.zip |
Add patches fixing rfc-3920 compliance, preventing segfaults and excessive debug messages, and fixing utf-8 validation of incoming messages (bug #389127, many thanks to Dmitry Potapov <potapov.d@gmail.com> for reporting). Also, move to EAPI4 and add USE=static-libs support. The Imendio upstream is gone, so use gnome.org for SRC_URI and set the github repo which is supposedly considered the closest thing to official that loudmouth has these days as the homepage.
(Portage version: 2.2.0_alpha72/cvs/Linux x86_64)
8 files changed, 458 insertions, 10 deletions
diff --git a/net-libs/loudmouth/ChangeLog b/net-libs/loudmouth/ChangeLog index f0913faed4f9..0d7937ec5d73 100644 --- a/net-libs/loudmouth/ChangeLog +++ b/net-libs/loudmouth/ChangeLog @@ -1,6 +1,22 @@ # ChangeLog for net-libs/loudmouth -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/ChangeLog,v 1.97 2010/09/09 13:36:28 ranger Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/ChangeLog,v 1.98 2011/11/02 02:56:40 tetromino Exp $ + +*loudmouth-1.4.3-r2 (02 Nov 2011) + + 02 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org> + loudmouth-1.4.3.ebuild, loudmouth-1.4.3-r1.ebuild, + +loudmouth-1.4.3-r2.ebuild, +files/loudmouth-1.4.3-free-before-closed.patch, + +files/loudmouth-1.4.3-id-tag-in-opening-headers.patch, + +files/loudmouth-1.4.3-invalid-unicode.patch, + +files/loudmouth-1.4.3-silence-chdir.patch: + Add patches fixing rfc-3920 compliance, preventing segfaults and excessive + debug messages, and fixing utf-8 validation of incoming messages (bug + #389127, many thanks to Dmitry Potapov <potapov.d@gmail.com> for reporting). + Also, move to EAPI4 and add USE=static-libs support. + The Imendio upstream is gone, so use gnome.org for SRC_URI and set the github + repo which is supposedly considered the closest thing to official that + loudmouth has these days as the homepage. 09 Sep 2010; Brent Baude <ranger@gentoo.org> loudmouth-1.4.3-r1.ebuild: Marking loudmouth-1.4.3-r1 ppc64 for bug 320273 diff --git a/net-libs/loudmouth/files/loudmouth-1.4.3-free-before-closed.patch b/net-libs/loudmouth/files/loudmouth-1.4.3-free-before-closed.patch new file mode 100644 index 000000000000..d6c43ae9d66f --- /dev/null +++ b/net-libs/loudmouth/files/loudmouth-1.4.3-free-before-closed.patch @@ -0,0 +1,137 @@ +From ff113220df9073c3e6078487e87b6a7b86e2d952 Mon Sep 17 00:00:00 2001 +From: Mikael Hallendal <micke@imendio.com> +Date: Sun, 30 Nov 2008 09:27:21 +0100 +Subject: [PATCH] Don't free connection internals before it's closed. [#34] + +When the connection freed up internal states (in this case the handler +lists) before closing itself it segfaulted when trying to unregister the +SASL handlers. + +Reported by Julien Puydt. +--- + loudmouth/lm-connection.c | 30 +++++++++++++++++------------- + loudmouth/lm-sasl.c | 18 +++++++++--------- + 2 files changed, 26 insertions(+), 22 deletions(-) + +diff --git a/loudmouth/lm-connection.c b/loudmouth/lm-connection.c +index 915c0ad..dda2978 100644 +--- a/loudmouth/lm-connection.c ++++ b/loudmouth/lm-connection.c +@@ -191,13 +191,21 @@ connection_free (LmConnection *connection) + { + int i; + ++ /* This needs to be run before starting to free internal states. ++ * It used to be run after the handlers where freed which lead to a crash ++ * when the connection was freed prior to running lm_connection_close. ++ */ ++ if (connection->state >= LM_CONNECTION_STATE_OPENING) { ++ connection_do_close (connection); ++ } ++ + g_free (connection->server); + g_free (connection->jid); + g_free (connection->effective_jid); + g_free (connection->stream_id); + g_free (connection->resource); + +- if (connection->sasl) { ++ if (connection->sasl) { + lm_sasl_free (connection->sasl); + } + +@@ -218,13 +226,9 @@ connection_free (LmConnection *connection) + + g_slist_free (connection->handlers[i]); + } +- + g_hash_table_destroy (connection->id_handlers); +- if (connection->state >= LM_CONNECTION_STATE_OPENING) { +- connection_do_close (connection); +- } + +- if (connection->open_cb) { ++ if (connection->open_cb) { + _lm_utils_free_callback (connection->open_cb); + } + +@@ -2030,11 +2034,11 @@ lm_connection_unregister_message_handler (LmConnection *connection, + g_return_if_fail (handler != NULL); + g_return_if_fail (type != LM_MESSAGE_TYPE_UNKNOWN); + +- for (l = connection->handlers[type]; l; l = l->next) { +- HandlerData *hd = (HandlerData *) l->data; +- ++ for (l = connection->handlers[type]; l; l = l->next) { ++ HandlerData *hd = (HandlerData *) l->data; ++ + if (handler == hd->handler) { +- connection->handlers[type] = g_slist_remove_link (connection->handlers[type], l); ++ connection->handlers[type] = g_slist_remove_link (connection->handlers[type], l); + g_slist_free (l); + lm_message_handler_unref (hd->handler); + g_free (hd); +@@ -2140,7 +2144,7 @@ lm_connection_ref (LmConnection *connection) + g_return_val_if_fail (connection != NULL, NULL); + + connection->ref_count++; +- ++ + return connection; + } + +@@ -2157,8 +2161,8 @@ lm_connection_unref (LmConnection *connection) + g_return_if_fail (connection != NULL); + + connection->ref_count--; +- ++ + if (connection->ref_count == 0) { +- connection_free (connection); ++ connection_free (connection); + } + } +diff --git a/loudmouth/lm-sasl.c b/loudmouth/lm-sasl.c +index 42ee0e1..e6a72f5 100644 +--- a/loudmouth/lm-sasl.c ++++ b/loudmouth/lm-sasl.c +@@ -807,27 +807,27 @@ lm_sasl_free (LmSASL *sasl) + g_free (sasl->server); + + if (sasl->features_cb) { +- lm_connection_unregister_message_handler (sasl->connection, +- sasl->features_cb, +- LM_MESSAGE_TYPE_STREAM_FEATURES); ++ lm_connection_unregister_message_handler (sasl->connection, ++ sasl->features_cb, ++ LM_MESSAGE_TYPE_STREAM_FEATURES); + } + + if (sasl->challenge_cb) { + lm_connection_unregister_message_handler (sasl->connection, +- sasl->challenge_cb, +- LM_MESSAGE_TYPE_CHALLENGE); ++ sasl->challenge_cb, ++ LM_MESSAGE_TYPE_CHALLENGE); + } + + if (sasl->success_cb) { + lm_connection_unregister_message_handler (sasl->connection, +- sasl->success_cb, +- LM_MESSAGE_TYPE_SUCCESS); ++ sasl->success_cb, ++ LM_MESSAGE_TYPE_SUCCESS); + } + + if (sasl->failure_cb) { + lm_connection_unregister_message_handler (sasl->connection, +- sasl->failure_cb, +- LM_MESSAGE_TYPE_FAILURE); ++ sasl->failure_cb, ++ LM_MESSAGE_TYPE_FAILURE); + } + + g_free (sasl); +-- +1.7.7.1 + diff --git a/net-libs/loudmouth/files/loudmouth-1.4.3-id-tag-in-opening-headers.patch b/net-libs/loudmouth/files/loudmouth-1.4.3-id-tag-in-opening-headers.patch new file mode 100644 index 000000000000..43b923a5e73f --- /dev/null +++ b/net-libs/loudmouth/files/loudmouth-1.4.3-id-tag-in-opening-headers.patch @@ -0,0 +1,35 @@ +From 6f3a168d985d37af42e747412b5d6d427b4d1ab8 Mon Sep 17 00:00:00 2001 +From: Will Thompson <will.thompson@collabora.co.uk> +Date: Wed, 5 Nov 2008 23:19:42 +0100 +Subject: [PATCH] Don't append the 'id'-tag in opening stream headers. [#30] + +According to RFC 3920 (section 4.4) the id attribute SHOULD NOT be added +by the initiating party. + +[#30 responsible:Hallski state:resolved milestone:Loudmouth 1.4.4 tagged:committed] +--- + loudmouth/lm-message.c | 8 +++++--- + 1 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/loudmouth/lm-message.c b/loudmouth/lm-message.c +index a7d1b46..e2fdcc2 100644 +--- a/loudmouth/lm-message.c ++++ b/loudmouth/lm-message.c +@@ -223,9 +223,11 @@ lm_message_new (const gchar *to, LmMessageType type) + + m->node = _lm_message_node_new (_lm_message_type_to_string (type)); + +- id = _lm_utils_generate_id (); +- lm_message_node_set_attribute (m->node, "id", id); +- g_free (id); ++ if (type != LM_MESSAGE_TYPE_STREAM) { ++ id = _lm_utils_generate_id (); ++ lm_message_node_set_attribute (m->node, "id", id); ++ g_free (id); ++ } + + if (to) { + lm_message_node_set_attribute (m->node, "to", to); +-- +1.7.7.1 + diff --git a/net-libs/loudmouth/files/loudmouth-1.4.3-invalid-unicode.patch b/net-libs/loudmouth/files/loudmouth-1.4.3-invalid-unicode.patch new file mode 100644 index 000000000000..2a97653c93cd --- /dev/null +++ b/net-libs/loudmouth/files/loudmouth-1.4.3-invalid-unicode.patch @@ -0,0 +1,144 @@ +From e08dbcca6cf50c834e2fe4e7290cce642903251d Mon Sep 17 00:00:00 2001 +From: Hermitifier <quantifier666@gmail.com> +Date: Mon, 3 Oct 2011 17:06:18 +0200 +Subject: [PATCH] Protect GMarkup parser against invalid unicode characters + +[Alexandre Rostovtsev <tetromino@gentoo.org>: backport to 1.4.3] + +http://loudmouth.lighthouseapp.com/projects/17276/tickets/61 +--- + loudmouth/lm-parser.c | 94 ++++++++++++++++++++++++++++++++++++++++++++----- + 1 files changed, 85 insertions(+), 9 deletions(-) + +diff --git a/loudmouth/lm-parser.c b/loudmouth/lm-parser.c +index 89f6675..0a61a56 100644 +--- a/loudmouth/lm-parser.c ++++ b/loudmouth/lm-parser.c +@@ -43,6 +43,8 @@ struct LmParser { + + GMarkupParser *m_parser; + GMarkupParseContext *context; ++ gchar *incomplete; /* incomplete utf-8 character ++ found at the end of buffer */ + }; + + +@@ -233,25 +235,98 @@ lm_parser_new (LmParserMessageFunction function, + parser->cur_root = NULL; + parser->cur_node = NULL; + ++ parser->incomplete = NULL; ++ + return parser; + } + ++static gchar * ++_lm_parser_make_valid (const gchar *buffer, gchar **incomplete) ++{ ++ GString *string; ++ const gchar *remainder, *invalid; ++ gint remaining_bytes, valid_bytes; ++ gunichar code; /*error code for invalid character*/ ++ ++ g_return_val_if_fail (buffer != NULL, NULL); ++ ++ string = NULL; ++ remainder = buffer; ++ remaining_bytes = strlen (buffer); ++ ++ while (remaining_bytes != 0) ++ { ++ if (g_utf8_validate (remainder, remaining_bytes, &invalid)) ++ break; ++ valid_bytes = invalid - remainder; ++ ++ if (string == NULL) ++ string = g_string_sized_new (remaining_bytes); ++ ++ g_string_append_len (string, remainder, valid_bytes); ++ ++ remainder = g_utf8_find_next_char(invalid, NULL); ++ remaining_bytes -= valid_bytes + (remainder - invalid); ++ ++ code = g_utf8_get_char_validated (invalid, -1); ++ ++ if (code == -1) { ++ /* A complete but invalid codepoint */ ++ /* append U+FFFD REPLACEMENT CHARACTER */ ++ g_string_append (string, "\357\277\275"); ++#ifndef LM_NO_DEBUG ++ g_debug ("invalid character!\n"); ++#endif ++ } else if (code == -2) { ++ /* Beginning of what could be a character */ ++ *incomplete = g_strdup (invalid); ++#ifndef LM_NO_DEBUG ++ g_debug ("incomplete character: %s\n", *incomplete); ++#endif ++ ++ g_assert (remaining_bytes == 0); ++ g_assert (*(g_utf8_find_next_char(invalid, NULL)) == '\0'); ++ } ++ } ++ ++ if (string == NULL) ++ return g_strdup (buffer); ++ ++ g_string_append (string, remainder); ++ ++ g_assert (g_utf8_validate (string->str, -1, NULL)); ++ ++ return g_string_free (string, FALSE); ++} ++ ++ + void + lm_parser_parse (LmParser *parser, const gchar *string) + { ++ gchar *valid, *completed; + g_return_if_fail (parser != NULL); + +- if (!parser->context) { +- parser->context = g_markup_parse_context_new (parser->m_parser, 0, +- parser, NULL); +- } +- +- if (g_markup_parse_context_parse (parser->context, string, +- (gssize)strlen (string), NULL)) { +- } else { ++ if (!parser->context) { ++ parser->context = g_markup_parse_context_new (parser->m_parser, 0, ++ parser, NULL); ++ } ++ ++ if (parser->incomplete) { ++ completed = g_strdup_printf("%s%s", parser->incomplete, string); ++ g_free(parser->incomplete); ++ parser->incomplete = NULL; ++ } else { ++ completed = g_strdup(string); ++ } ++ valid = _lm_parser_make_valid (completed, &parser->incomplete); ++ g_free(completed); ++ if (g_markup_parse_context_parse (parser->context, valid, ++ (gssize)strlen (valid), NULL)) { ++ } else { + g_markup_parse_context_free (parser->context); + parser->context = NULL; +- } ++ } ++ g_free(valid); + } + + void +@@ -264,6 +339,7 @@ lm_parser_free (LmParser *parser) + if (parser->context) { + g_markup_parse_context_free (parser->context); + } ++ g_free (parser->incomplete); + g_free (parser->m_parser); + g_free (parser); + } +-- +1.7.7.1 + diff --git a/net-libs/loudmouth/files/loudmouth-1.4.3-silence-chdir.patch b/net-libs/loudmouth/files/loudmouth-1.4.3-silence-chdir.patch new file mode 100644 index 000000000000..0ee8c940fade --- /dev/null +++ b/net-libs/loudmouth/files/loudmouth-1.4.3-silence-chdir.patch @@ -0,0 +1,33 @@ +From 4d8a5ea64abb65ed086efc3e32125c529068acbe Mon Sep 17 00:00:00 2001 +From: Mikael Hallendal <micke@imendio.com> +Date: Wed, 19 Nov 2008 10:16:40 +0100 +Subject: [PATCH] Silence chdir by catching return value + +--- + loudmouth/asyncns.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/loudmouth/asyncns.c b/loudmouth/asyncns.c +index 9b238fa..55cb471 100644 +--- a/loudmouth/asyncns.c ++++ b/loudmouth/asyncns.c +@@ -382,6 +382,7 @@ static int process_worker(int in_fd, int out_fd) { + int have_death_sig = 0; + assert(in_fd > 2); + assert(out_fd > 2); ++ int no_warn; + + close(0); + close(1); +@@ -391,7 +392,7 @@ static int process_worker(int in_fd, int out_fd) { + open("/dev/null", O_WRONLY); + open("/dev/null", O_WRONLY); + +- chdir("/"); ++ no_warn = chdir("/"); + + if (geteuid() == 0) { + struct passwd *pw; +-- +1.7.7.1 + diff --git a/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild b/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild index f416f30a29f8..fb4ecedf8dd1 100644 --- a/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild +++ b/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild @@ -1,12 +1,11 @@ -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild,v 1.11 2010/09/09 13:36:28 ranger Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/loudmouth-1.4.3-r1.ebuild,v 1.12 2011/11/02 02:56:39 tetromino Exp $ inherit autotools gnome2 DESCRIPTION="Lightweight C Jabber library" -HOMEPAGE="http://www.loudmouth-project.org/" -SRC_URI="http://ftp.imendio.com/pub/imendio/${PN}/src/${P}.tar.bz2" +HOMEPAGE="https://github.com/engineyard/loudmouth" LICENSE="LGPL-2.1" SLOT="0" diff --git a/net-libs/loudmouth/loudmouth-1.4.3-r2.ebuild b/net-libs/loudmouth/loudmouth-1.4.3-r2.ebuild new file mode 100644 index 000000000000..718a6e5146bd --- /dev/null +++ b/net-libs/loudmouth/loudmouth-1.4.3-r2.ebuild @@ -0,0 +1,85 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/loudmouth-1.4.3-r2.ebuild,v 1.1 2011/11/02 02:56:40 tetromino Exp $ + +EAPI="4" +GNOME_TARBALL_SUFFIX="bz2" +GNOME2_LA_PUNT="yes" + +inherit autotools eutils gnome2 + +DESCRIPTION="Lightweight C Jabber library" +HOMEPAGE="https://github.com/engineyard/loudmouth" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos" + +IUSE="asyncns debug doc ssl static-libs test" + +RDEPEND=">=dev-libs/glib-2.4 + ssl? ( >=net-libs/gnutls-1.4.0 ) + asyncns? ( net-libs/libasyncns )" +# FIXME: +# openssl dropped because of bug #216705 + +DEPEND="${RDEPEND} + test? ( dev-libs/check ) + dev-util/pkgconfig + doc? ( >=dev-util/gtk-doc-1 ) + >=dev-util/gtk-doc-am-1" + +DOCS="AUTHORS ChangeLog NEWS README" + +pkg_setup() { + G2CONF="${G2CONF} $(use_enable debug) $(use_enable static-libs static)" + + if use ssl; then + G2CONF="${G2CONF} --with-ssl=gnutls" + else + G2CONF="${G2CONF} --with-ssl=no" + fi + + if use asyncns; then + G2CONF="${G2CONF} --with-asyncns=system" + else + G2CONF="${G2CONF} --without-asyncns" + fi +} + +src_prepare() { + gnome2_src_prepare + + # Use system libasyncns, bug #236844 + epatch "${FILESDIR}/${P}-asyncns-system.patch" + + # Fix detection of gnutls-2.8, bug #272027 + epatch "${FILESDIR}/${P}-gnutls28.patch" + + # Fix digest auth with SRV (or similar) + # Upstream: http://loudmouth.lighthouseapp.com/projects/17276-libloudmouth/tickets/44-md5-digest-uri-not-set-correctly-when-using-srv + epatch "${FILESDIR}/${P}-fix-sasl-md5-digest-uri.patch" + + # Drop stanzas when failing to convert them to LmMessages + # From debian.. + epatch "${FILESDIR}/${P}-drop-stanzas-on-fail.patch" + + # Don't check for sync dns problems when using asyncns [#33] + # From debian.. + epatch "${FILESDIR}/${P}-async-fix.patch" + + # Don't append id tag in opening headers [#30] + epatch "${FILESDIR}/${P}-id-tag-in-opening-headers.patch" + + # Silence chdir, from engineyard git + epatch "${FILESDIR}/${P}-silence-chdir.patch" + + # Don't free connection internals before connection is closed [#34] + epatch "${FILESDIR}/${P}-free-before-closed.patch" + + # Check for invalid utf8, bug #389127 + # Upstream: http://loudmouth.lighthouseapp.com/projects/17276/tickets/61 + epatch "${FILESDIR}/${P}-invalid-unicode.patch" + + eautoreconf +} diff --git a/net-libs/loudmouth/loudmouth-1.4.3.ebuild b/net-libs/loudmouth/loudmouth-1.4.3.ebuild index 099b56275d42..93e4ff459088 100644 --- a/net-libs/loudmouth/loudmouth-1.4.3.ebuild +++ b/net-libs/loudmouth/loudmouth-1.4.3.ebuild @@ -1,12 +1,11 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/loudmouth-1.4.3.ebuild,v 1.10 2009/06/17 22:09:46 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-libs/loudmouth/loudmouth-1.4.3.ebuild,v 1.11 2011/11/02 02:56:39 tetromino Exp $ inherit autotools gnome2 DESCRIPTION="Lightweight C Jabber library" -HOMEPAGE="http://www.loudmouth-project.org/" -SRC_URI="http://ftp.imendio.com/pub/imendio/${PN}/src/${P}.tar.bz2" +HOMEPAGE="https://github.com/engineyard/loudmouth" LICENSE="LGPL-2.1" SLOT="0" |