Wednesday, January 03, 2024

Re: mcabber: TLS does not work, libmouth update crashes

On Wed, Jan 03, 2024 at 10:03:53AM +0100, Markus Hennecke wrote:
> Am 03.01.2024 um 00:51 schrieb Klemens Nanni:
> > Anyone successfully using mcabber?
> > Plain -current without config fails to connect via TLS:
> >
> > $ mcabber
> > /set jid = user@example.com
> > /set server = example.com
> > /set password = secret
> > /connect
> > [00:41:16] No configuration file has been found.
> > [00:41:41] Connecting to server: pimux.de
> > [00:41:41] with resource mcabber.ccd21665
> > [00:41:42] Disconnected, reason: 3->'LM_DISCONNECT_REASON_ERROR'
> > [interleaved stderr]
> > ** (process:70988): WARNING **: 00:42:51.509: SSL_connect(): -1 / SSL_ERROR_SSL
> > ** (process:70988): WARNING **: 00:42:51.509: error:1404E0BF:SSL routines:ST_BEFORE_CONNECT:no protocols available
> >
> > '/set tls = 1' (default) makes no difference.
> >
> > Updating outdated(/unmaintained/dead) loudmouth to 1.5.4 and rebuilding
> > mcabber only causes various different *-after-free errors, this is my
> > minimal reproducer
>
> Can you retry without any patches for loudmouth 1.5.4? The port that is
> sitting in my tree looks the same Makefile wise, but I have an empty/no
> patches directory. That version builds on arm64 and connects just fine to my
> server offering TLSv1.3. I can recheck on amd64 later.

Retrying with net/loudmouth/patches/ removed, mcabber works if and only
if I set 'server' correctly:
/set jid = user@example.com
/set server = example.com
/set password = secret
/connect

If 'server' remains unset, mcabber dies regardless of credentials:

mcabber(54795) in free(): write to free mem 0xac5f62b5f30[0..7]@144
Abort trap (core dumped)

#0 thrkill () at /tmp/-:2
#1 0x41b5616ae663659b in ?? ()
#2 0x00000ac58f00b3c2 in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51
#3 0x00000ac58efe692e in wrterror (d=0xac5e129d9a8, msg=0xac58ef54cc4 "write to free mem %p[%zu..%zu]@%zu")
at /usr/src/lib/libc/stdlib/malloc.c:378
#4 0x00000ac58efe8290 in validate_junk (pool=0xac5e129d9a8, p=0xac5f62b5f30, argsz=144) at /usr/src/lib/libc/stdlib/malloc.c:780
#5 ofree (argpool=0x72f735171b70, p=0xac603e01b60, clear=<optimized out>, check=<optimized out>, argsz=<optimized out>)
at /usr/src/lib/libc/stdlib/malloc.c:1694
#6 0x00000ac58efe7a33 in _libc_free (ptr=0xac603e01b60) at /usr/src/lib/libc/stdlib/malloc.c:1747
#7 0x00000ac54a4ac22f in g_main_dispatch (context=0xac5a1e0a6e0) at ../glib-2.78.3/glib/gmain.c:3490
#8 g_main_context_dispatch_unlocked (context=0xac5a1e0a6e0) at ../glib-2.78.3/glib/gmain.c:4284
#9 0x00000ac54a4ac5ec in g_main_context_iterate_unlocked (context=0xac5a1e0a6e0, block=1, dispatch=1, self=<optimized out>)
at ../glib-2.78.3/glib/gmain.c:4349
#10 0x00000ac54a4ac69b in g_main_context_iteration (context=0xac5a1e0a6e0, may_block=1) at ../glib-2.78.3/glib/gmain.c:4414
#11 0x00000ac32184a538 in ?? ()
#12 0x00000ac321849a41 in ?? ()
#13 0x0000000000000000 in ?? ()

Full diff I tried below.

> But AFAIR that build of loudmouth-1.5.4 was breaking the freetalk port that
> crashed during connect the last time I checked.

Our freetalk seems dead, anyway, see 'broken net/freetalk' on ports@.

Index: net/mcabber/Makefile
===================================================================
RCS file: /cvs/ports/net/mcabber/Makefile,v
diff -u -p -r1.42 Makefile
--- net/mcabber/Makefile 27 Sep 2023 14:18:18 -0000 1.42
+++ net/mcabber/Makefile 3 Jan 2024 10:21:29 -0000
@@ -1,7 +1,7 @@
COMMENT= console jabber client
DISTNAME= mcabber-1.1.2
CATEGORIES= net
-REVISION= 0
+REVISION= 1

HOMEPAGE= https://mcabber.com/

@@ -10,17 +10,16 @@ MAINTAINER= Markus Hennecke <markus-hen
# GPLv2+ with SSL exemption
PERMIT_PACKAGE= Yes

+# uses pledge()
WANTLIB += assuan c crypto curses gcrypt glib-2.0 gpg-error gpgme iconv
WANTLIB += idn intl loudmouth-1>=3 otr panel pcre2-8 pthread ssl

SITES= ${HOMEPAGE}/files/
EXTRACT_SUFX= .tar.bz2

-# uses pledge()
-
LIB_DEPENDS= devel/glib2 \
security/gpgme \
- net/loudmouth \
+ net/loudmouth>=1.5.4 \
devel/libidn \
security/libotr \
devel/gettext,-runtime
Index: net/loudmouth/Makefile
===================================================================
RCS file: /cvs/ports/net/loudmouth/Makefile,v
diff -u -p -r1.31 Makefile
--- net/loudmouth/Makefile 27 Sep 2023 14:18:17 -0000 1.31
+++ net/loudmouth/Makefile 3 Jan 2024 10:21:29 -0000
@@ -1,9 +1,8 @@
COMMENT= lightweight Jabber client library

-V= 1.4.3
+V= 1.5.4
DISTNAME= loudmouth-$V
-REVISION= 8
-SHARED_LIBS += loudmouth-1 3.0 # .1.0
+SHARED_LIBS = loudmouth-1 3.1 # 1.0
CATEGORIES= net devel

HOMEPAGE= http://groups.google.com/group/loudmouth-dev/
@@ -11,9 +10,10 @@ HOMEPAGE= http://groups.google.co
# LGPLv2.1
PERMIT_PACKAGE= Yes

-WANTLIB = crypto glib-2.0 iconv idn>=16 intl pcre2-8 pthread ssl
+WANTLIB = crypto ffi glib-2.0 gobject-2.0 iconv idn intl pcre2-8
+WANTLIB += pthread ssl

-SITES= ${SITE_GNOME:=sources/loudmouth/${V:C/^([0-9]+\.[0-9]+).*/\1/}/}
+SITES= https://mcabber.com/files/loudmouth/
EXTRACT_SUFX= .tar.bz2

LIB_DEPENDS= devel/glib2 \
@@ -24,6 +24,9 @@ TEST_DEPENDS= devel/check
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= --disable-mono \
--with-check=${LOCALBASE} \
+ --with-compile-warnings=yes \
--with-ssl=openssl
+
+SEPARATE_BUILD = Yes

.include <bsd.port.mk>
Index: net/loudmouth/distinfo
===================================================================
RCS file: /cvs/ports/net/loudmouth/distinfo,v
diff -u -p -r1.6 distinfo
--- net/loudmouth/distinfo 18 Jan 2015 03:14:42 -0000 1.6
+++ net/loudmouth/distinfo 3 Jan 2024 10:21:29 -0000
@@ -1,2 +1,2 @@
-SHA256 (loudmouth-1.4.3.tar.bz2) = lak/XQCbceqBk9mUqhHzEbwzCj7+G3zXTcSPEcf5KeM=
-SIZE (loudmouth-1.4.3.tar.bz2) = 366818
+SHA256 (loudmouth-1.5.4.tar.bz2) = McvJHB/dzFNGszc7j7RVlOnqnMf+NtBZXokSxHrZTQ0=
+SIZE (loudmouth-1.5.4.tar.bz2) = 361323
Index: net/loudmouth/patches/patch-configure
===================================================================
RCS file: net/loudmouth/patches/patch-configure
diff -N net/loudmouth/patches/patch-configure
--- net/loudmouth/patches/patch-configure 11 Mar 2022 19:46:18 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
---- configure.orig Wed Oct 29 21:25:57 2008
-+++ configure Tue Nov 18 12:33:20 2008
-@@ -21423,6 +21423,7 @@ cat >>conftest.$ac_ext <<_ACEOF
-
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
-
- #include <check.h>
-
-@@ -21532,6 +21533,7 @@ cat >>conftest.$ac_ext <<_ACEOF
-
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
-
- #include <check.h>
-
Index: net/loudmouth/patches/patch-loudmouth_Makefile_in
===================================================================
RCS file: net/loudmouth/patches/patch-loudmouth_Makefile_in
diff -N net/loudmouth/patches/patch-loudmouth_Makefile_in
--- net/loudmouth/patches/patch-loudmouth_Makefile_in 11 Mar 2022 19:46:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
---- loudmouth/Makefile.in.orig Mon Aug 4 13:37:02 2008
-+++ loudmouth/Makefile.in Mon Aug 4 13:37:12 2008
-@@ -306,8 +306,7 @@ libloudmouthinclude_HEADERS = \
-
- libloudmouth_1_la_LIBADD = \
- $(LOUDMOUTH_LIBS) \
-- $(LIBIDN_LIBS) \
-- -lresolv
-+ $(LIBIDN_LIBS)
-
- libloudmouth_1_la_LDFLAGS = \
- -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
Index: net/loudmouth/patches/patch-loudmouth_lm-error_c
===================================================================
RCS file: net/loudmouth/patches/patch-loudmouth_lm-error_c
diff -N net/loudmouth/patches/patch-loudmouth_lm-error_c
--- net/loudmouth/patches/patch-loudmouth_lm-error_c 11 Mar 2022 19:46:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-error: #error "Only <glib.h> can be included directly."
-
---- loudmouth/lm-error.c.orig Sun Mar 18 07:26:55 2012
-+++ loudmouth/lm-error.c Sun Mar 18 07:27:04 2012
-@@ -19,7 +19,7 @@
- */
-
- #include <config.h>
--#include <glib/gerror.h>
-+#include <glib.h>
- #include "lm-error.h"
-
- /**
Index: net/loudmouth/patches/patch-loudmouth_lm-sock_c
===================================================================
RCS file: net/loudmouth/patches/patch-loudmouth_lm-sock_c
diff -N net/loudmouth/patches/patch-loudmouth_lm-sock_c
--- net/loudmouth/patches/patch-loudmouth_lm-sock_c 11 Mar 2022 19:46:18 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
---- loudmouth/lm-sock.c.orig Sun Aug 31 13:42:29 2008
-+++ loudmouth/lm-sock.c Sun Aug 31 13:43:08 2008
-@@ -29,7 +29,9 @@
- #include <string.h>
- #include <unistd.h>
- #include <sys/socket.h>
-+#include <sys/types.h>
- #include <fcntl.h>
-+#include <netinet/in_systm.h>
-
- /* Needed for BSD, LM-130 */
- #ifdef HAVE_NETINET_IN_SYSTM_H
Index: net/loudmouth/patches/patch-loudmouth_lm-ssl-openssl_c
===================================================================
RCS file: net/loudmouth/patches/patch-loudmouth_lm-ssl-openssl_c
diff -N net/loudmouth/patches/patch-loudmouth_lm-ssl-openssl_c
--- net/loudmouth/patches/patch-loudmouth_lm-ssl-openssl_c 11 Mar 2022 19:46:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
---- loudmouth/lm-ssl-openssl.c.orig Mon Jan 19 11:50:51 2009
-+++ loudmouth/lm-ssl-openssl.c Mon Jan 19 11:51:45 2009
-@@ -305,6 +305,14 @@ _lm_ssl_initialize (LmSSL *ssl)
- g_warning ("SSL_CTX_new() == NULL");
- abort();
- }
-+ /* Set the NO_TICKET option on the context to allow for talk to Google Talk
-+ * which apparently seems to be having a problem handling empty session
-+ * tickets due to a bug in Java.
-+ *
-+ * See http://twistedmatrix.com/trac/ticket/3463 and
-+ * Loudmouth [#28].
-+ */
-+ SSL_CTX_set_options (ssl->ssl_ctx, SSL_OP_NO_TICKET);
- /*if (access("/etc/ssl/cert.pem", R_OK) == 0)
- cert_file = "/etc/ssl/cert.pem";
- if (!SSL_CTX_load_verify_locations(ssl->ssl_ctx,
Index: net/loudmouth/patches/patch-tests-Makefile_in
===================================================================
RCS file: net/loudmouth/patches/patch-tests-Makefile_in
diff -N net/loudmouth/patches/patch-tests-Makefile_in
--- net/loudmouth/patches/patch-tests-Makefile_in 11 Mar 2022 19:46:18 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
---- tests/Makefile.in.orig Mon Aug 4 13:23:35 2008
-+++ tests/Makefile.in Mon Aug 4 13:24:03 2008
-@@ -52,7 +52,7 @@ test_objects_LDADD = $(LDADD)
- am_test_parser_OBJECTS = test-parser.$(OBJEXT)
- test_parser_OBJECTS = $(am_test_parser_OBJECTS)
- test_parser_LDADD = $(LDADD)
--DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I${TRUEPREFIX}/include
- depcomp = $(SHELL) $(top_srcdir)/depcomp
- am__depfiles_maybe = depfiles
- COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-@@ -127,7 +127,7 @@ INSTALL_DATA = @INSTALL_DATA@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
- INSTALL_SCRIPT = @INSTALL_SCRIPT@
- INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
--LDFLAGS = @LDFLAGS@
-+LDFLAGS = @LDFLAGS@ -lcheck
- LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
- LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
- LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
Index: net/loudmouth/pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/loudmouth/pkg/PLIST,v
diff -u -p -r1.3 PLIST
--- net/loudmouth/pkg/PLIST 11 Mar 2022 19:46:18 -0000 1.3
+++ net/loudmouth/pkg/PLIST 3 Jan 2024 10:21:29 -0000
@@ -9,28 +9,7 @@ include/loudmouth-1.0/loudmouth/lm-proxy
include/loudmouth-1.0/loudmouth/lm-ssl.h
include/loudmouth-1.0/loudmouth/lm-utils.h
include/loudmouth-1.0/loudmouth/loudmouth.h
-lib/libloudmouth-1.a
+@static-lib lib/libloudmouth-1.a
lib/libloudmouth-1.la
@lib lib/libloudmouth-1.so.${LIBloudmouth-1_VERSION}
lib/pkgconfig/loudmouth-1.0.pc
-share/gtk-doc/
-share/gtk-doc/html/
-share/gtk-doc/html/loudmouth/
-share/gtk-doc/html/loudmouth/ch01.html
-share/gtk-doc/html/loudmouth/home.png
-share/gtk-doc/html/loudmouth/index.html
-share/gtk-doc/html/loudmouth/index.sgml
-share/gtk-doc/html/loudmouth/left.png
-share/gtk-doc/html/loudmouth/loudmouth-lm-connection.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-error.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-message-handler.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-message-node.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-message.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-proxy.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-ssl.html
-share/gtk-doc/html/loudmouth/loudmouth-lm-utils.html
-share/gtk-doc/html/loudmouth/loudmouth.devhelp
-share/gtk-doc/html/loudmouth/loudmouth.devhelp2
-share/gtk-doc/html/loudmouth/right.png
-share/gtk-doc/html/loudmouth/style.css
-share/gtk-doc/html/loudmouth/up.png

No comments:

Post a Comment