cyrus-sasl rebuild

This commit is contained in:
Rmys
2021-12-03 15:24:56 +03:00
parent 065664bdaf
commit c06ff65222
37 changed files with 309 additions and 1154 deletions
@@ -0,0 +1,16 @@
https://bugzilla.cyrusimap.org/show_bug.cgi?id=3590
https://bugs.gentoo.org/show_bug.cgi?id=392761
--- cyrus-sasl-2.1.25/lib/auxprop.c~ 2011-10-20 17:33:46.423015318 +0200
+++ cyrus-sasl-2.1.25/lib/auxprop.c 2011-10-20 17:48:49.336348654 +0200
@@ -971,6 +971,10 @@
}
if(!found) {
+ /* compatibility with <= 2.1.23, ignore the lack of auxrop plugin */
+ if (!plist)
+ result = SASL_OK;
+ else
_sasl_log(sparams->utils->conn, SASL_LOG_DEBUG,
"could not find auxprop plugin, was searching for '%s'",
plist ? plist : "[all]");
@@ -0,0 +1,13 @@
Gentoo bug #458790
--- a/include/sasl.h
+++ b/include/sasl.h
@@ -121,6 +121,9 @@
#ifndef SASL_H
#define SASL_H 1
+/* stddef.h to get size_t defined */
+#include <stddef.h>
+
/* Keep in sync with win32/common.mak */
#define SASL_VERSION_MAJOR 2
#define SASL_VERSION_MINOR 1
@@ -0,0 +1,20 @@
Description: CVE-2019-19906: Off-by-one in _sasl_add_string function
Origin: vendor
Bug: https://github.com/cyrusimap/cyrus-sasl/issues/587
Bug-Debian: https://bugs.debian.org/947043
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2019-19906
Author: Stephan Zeisberg <stephan@srlabs.de>
Reviewed-by: Salvatore Bonaccorso <carnil@debian.org>
Last-Update: 2019-12-19
--- a/lib/common.c
+++ b/lib/common.c
@@ -190,7 +190,7 @@ int _sasl_add_string(char **out, size_t
if (add==NULL) add = "(null)";
- addlen=strlen(add); /* only compute once */
+ addlen=strlen(add)+1; /* only compute once */
if (_buf_alloc(out, alloclen, (*outlen)+addlen)!=SASL_OK)
return SASL_NOMEM;
@@ -0,0 +1,25 @@
Author: Matthias Klose <doko@ubuntu.com>
Desription: Fix FTBFS, add $(SASL_DB_LIB) as dependency to libsasldb, and use
it.
--- cyrus-sasl-2.1.27/saslauthd/Makefile.am
+++ cyrus-sasl-2.1.27/saslauthd/Makefile.am
@@ -25,7 +25,7 @@
saslauthd_DEPENDENCIES = saslauthd-main.o $(LTLIBOBJS_FULL)
saslauthd_LDADD = @SASL_KRB_LIB@ \
@GSSAPIBASE_LIBS@ @LIB_CRYPT@ @LIB_SIA@ \
- @LIB_SOCKET@ @SASL_DB_LIB@ @LIB_PAM@ @LDAP_LIBS@ $(LTLIBOBJS_FULL) $(CRYPTO_COMPAT_OBJS) $(LIBSASLDB_OBJS)
+ @LIB_SOCKET@ ../sasldb/libsasldb.la @LIB_PAM@ @LDAP_LIBS@ $(LTLIBOBJS_FULL) $(CRYPTO_COMPAT_OBJS) $(LIBSASLDB_OBJS)
testsaslauthd_SOURCES = testsaslauthd.c utils.c
testsaslauthd_LDADD = @LIB_SOCKET@
--- cyrus-sasl-2.1.27/sasldb/Makefile.am
+++ cyrus-sasl-2.1.27/sasldb/Makefile.am
@@ -54,6 +54,6 @@
libsasldb_la_SOURCES = allockey.c sasldb.h
EXTRA_libsasldb_la_SOURCES = $(extra_common_sources)
-libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND)
-libsasldb_la_LIBADD = $(SASL_DB_BACKEND)
+libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
+libsasldb_la_LIBADD = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
libsasldb_la_LDFLAGS = -no-undefined
@@ -0,0 +1,45 @@
https://bugs.gentoo.org/825342
commit 5664c3f535289ce9efb513a2897991b5c436bb44
Author: Pavel Raiskup <praiskup@redhat.com>
Date: Thu Apr 1 17:26:28 2021 +0200
configure.ac: properly quote macro arguments
Autoconf 2.70+ is more picky about the quotation (even though with
previous versions the arguments should have been quoted, too). When we
don't quote macros inside the AC_CACHE_VAL macro - some of the Autoconf
initialization is wrongly ordered in ./configure script and we keep
seeing bugs like:
./configure: line 2165: ac_fn_c_try_run: command not found
Original report: https://bugzilla.redhat.com/1943013
Signed-off-by: Pavel Raiskup <praiskup@redhat.com>
--- a/configure.ac
+++ b/configure.ac
@@ -213,7 +213,8 @@ if test $sasl_cv_uscore = yes; then
AC_MSG_CHECKING(whether dlsym adds the underscore for us)
cmu_save_LIBS="$LIBS"
LIBS="$LIBS $SASL_DL_LIB"
- AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
+ AC_CACHE_VAL([sasl_cv_dlsym_adds_uscore],
+ [AC_TRY_RUN([
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
@@ -221,9 +222,9 @@ void foo() { int i=0;}
int main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
if(ptr1 && !ptr2) exit(0); } exit(1); }
-], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
- AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?]),
- AC_MSG_WARN(cross-compiler, we'll do our best)))
+], [sasl_cv_dlsym_adds_uscore=yes], [sasl_cv_dlsym_adds_uscore=no
+ AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?])],
+ [AC_MSG_WARN(cross-compiler, we'll do our best)])])
LIBS="$cmu_save_LIBS"
AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
@@ -0,0 +1,31 @@
--- cyrus-sasl-2.1.27/configure.ac
+++ cyrus-sasl-2.1.27/configure.ac
@@ -44,6 +44,8 @@
AC_PREREQ(2.63)
+AC_CONFIG_MACRO_DIR([config])
+
dnl
dnl REMINDER: When changing the version number here, please also update
dnl the values in win32/include/config.h and include/sasl.h as well.
--- cyrus-sasl-2.1.27/Makefile.am
+++ cyrus-sasl-2.1.27/Makefile.am
@@ -44,6 +44,8 @@
#
################################################################
+ACLOCAL_AMFLAGS = -I config
+
if SASLAUTHD
SAD = saslauthd
else
--- cyrus-sasl-2.1.27/saslauthd/Makefile.am
+++ cyrus-sasl-2.1.27/saslauthd/Makefile.am
@@ -1,4 +1,6 @@
AUTOMAKE_OPTIONS = 1.7
+ACLOCAL_AMFLAGS = -I ../config
+
sbin_PROGRAMS = saslauthd testsaslauthd
EXTRA_PROGRAMS = saslcache
@@ -0,0 +1,17 @@
Author: Fabian Fagerholm <fabbe@debian.org>
Description: This patch makes sure the non-PIC version of libsasldb.a, which
is created out of non-PIC objects, is not going to overwrite the PIC version,
which is created out of PIC objects. The PIC version is placed in .libs, and
the non-PIC version in the current directory. This ensures that both non-PIC
and PIC versions are available in the correct locations.
--- cyrus-sasl-2.1.27/lib/Makefile.am
+++ cyrus-sasl-2.1.27/lib/Makefile.am
@@ -98,7 +98,7 @@
libsasl2.a: libsasl2.la $(SASL_STATIC_OBJS)
@echo adding static plugins and dependencies
- $(AR) cru .libs/$@ $(SASL_STATIC_OBJS)
+ $(AR) cru $@ $(SASL_STATIC_OBJS)
@for i in ./libsasl2.la ../common/libplugin_common.la ../sasldb/libsasldb.la ../plugins/lib*.la; do \
if test ! -f $$i; then continue; fi; . $$i; \
for j in $$dependency_libs foo; do \
@@ -0,0 +1,35 @@
From af48f6fec9a7b6374d4153c5db894d4a1f349645 Mon Sep 17 00:00:00 2001
Message-Id: <af48f6fec9a7b6374d4153c5db894d4a1f349645.1635327406.git.mkletzan@redhat.com>
From: Jonas Jelten <jj@sft.mx>
Date: Sat, 2 Feb 2019 20:53:37 +0100
Subject: [PATCH] db_gdbm: fix gdbm_errno overlay from gdbm_close
`gdbm_close` also sets gdbm_errno since version 1.17.
This leads to a problem in `libsasl` as the `gdbm_close` incovation overlays
the `gdbm_errno` value which is then later used for the error handling.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
sasldb/db_gdbm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sasldb/db_gdbm.c b/sasldb/db_gdbm.c
index ee56a6bf8516..c908808e04a1 100644
--- a/sasldb/db_gdbm.c
+++ b/sasldb/db_gdbm.c
@@ -107,9 +107,11 @@ int _sasldb_getdata(const sasl_utils_t *utils,
gkey.dptr = key;
gkey.dsize = key_len;
gvalue = gdbm_fetch(db, gkey);
+ int fetch_errno = gdbm_errno;
+
gdbm_close(db);
if (! gvalue.dptr) {
- if (gdbm_errno == GDBM_ITEM_NOT_FOUND) {
+ if (fetch_errno == GDBM_ITEM_NOT_FOUND) {
utils->seterror(conn, SASL_NOLOG,
"user: %s@%s property: %s not found in %s",
authid, realm, propName, path);
--
2.33.1
@@ -0,0 +1,11 @@
--- cyrus-sasl-2.1.27/docsrc/exts/sphinxlocal/writers/manpage.py
+++ cyrus-sasl-2.1.27/docsrc/exts/sphinxlocal/writers/manpage.py
@@ -23,7 +23,7 @@
from sphinx import addnodes
from sphinx.locale import admonitionlabels, _
from sphinx.util.osutil import ustrftime
-from sphinx.util.compat import docutils_version
+#from sphinx.util.compat import docutils_version
class CyrusManualPageWriter(ManualPageWriter):
@@ -0,0 +1,16 @@
Gentoo bug #389349
--- cyrus-sasl-2.1.27/m4/sasl2.m4
+++ cyrus-sasl-2.1.27/m4/sasl2.m4
@@ -220,7 +220,11 @@
[AC_WARN([Cybersafe define not found])])
elif test "$ac_cv_header_gssapi_h" = "yes"; then
- AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
+ AC_EGREP_CPP(hostbased_service_gss_nt_yes, gssapi.h,
+ [#include <gssapi.h>
+ #ifdef GSS_C_NT_HOSTBASED_SERVICE
+ hostbased_service_gss_nt_yes
+ #endif],
[AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,
[Define if your GSSAPI implementation defines GSS_C_NT_HOSTBASED_SERVICE])])
elif test "$ac_cv_header_gssapi_gssapi_h"; then
@@ -0,0 +1,53 @@
auth_rimap: provide naive memmem implementation if missing
read_response uses memmem, which is not available on e.g. Solaris 10
Bug: https://github.com/cyrusimap/cyrus-sasl/pull/551
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
--- a/saslauthd/auth_rimap.c
+++ b/saslauthd/auth_rimap.c
@@ -367,6 +367,32 @@
/* END FUNCTION: process_login_reply */
+#ifndef HAVE_MEMMEM
+static void *memmem(
+ const void *big, size_t big_len,
+ const void *little, size_t little_len)
+{
+ const char *bp = (const char *)big;
+ const char *lp = (const char *)little;
+ size_t l;
+
+ if (big_len < little_len || little_len == 0 || big_len == 0)
+ return NULL;
+
+ while (big_len > 0) {
+ for (l = 0; l < little_len; l++) {
+ if (bp[l] != lp[l])
+ break;
+ }
+ if (l == little_len)
+ return (void *)bp;
+ bp++;
+ }
+
+ return NULL;
+}
+#endif
+
static int read_response(int s, char *rbuf, int buflen, const char *tag)
{
int rc = 0;
--- a/configure.ac
+++ b/configure.ac
@@ -1292,7 +1292,7 @@
#AC_FUNC_MEMCMP
#AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase asprintf strlcat strlcpy)
+AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy memmem mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase asprintf strlcat strlcpy)
if test $ac_cv_func_getspnam = yes; then
AC_MSG_CHECKING(if getpwnam_r/getspnam_r take 5 arguments)
@@ -0,0 +1,18 @@
https://github.com/cyrusimap/cyrus-sasl/pull/623
https://bugs.gentoo.org/775875
From 5b8075eeba8d0334573689450b07610c176a2618 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Wed, 9 Sep 2020 07:29:38 -0700
Subject: [PATCH] common: Define the missing crypto_compat_version version.
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -46,6 +46,7 @@
# See <http://www.gnu.org/software/libtool/manual/libtool.html#Versioning>
# CURRENT:REVISION:AGE
plugin_common_version = 3:0:0
+crypto_compat_version = 0:0:0
AM_CPPFLAGS=-fPIC -I$(top_srcdir)/include -I$(top_builddir)/include