From 370de217df176307da52a39b917f7732f09f3be5 Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy Date: Aug 10 2021 12:56:31 +0000 Subject: Preserve GDBM error to correctly deal with GDBM sasldb Related: rhbz#1952926 --- diff --git a/cyrus-sasl-2.1.27-Migration-from-BerkeleyDB.patch b/cyrus-sasl-2.1.27-Migration-from-BerkeleyDB.patch index 2a0ea8b..beffea3 100644 --- a/cyrus-sasl-2.1.27-Migration-from-BerkeleyDB.patch +++ b/cyrus-sasl-2.1.27-Migration-from-BerkeleyDB.patch @@ -38,9 +38,17 @@ diff -up cyrus-sasl-2.1.27/m4/sasldb.m4.frombdb cyrus-sasl-2.1.27/m4/sasldb.m4 case "$dblib" in diff -up cyrus-sasl-2.1.27/sasldb/db_gdbm.c.frombdb cyrus-sasl-2.1.27/sasldb/db_gdbm.c ---- cyrus-sasl-2.1.27/sasldb/db_gdbm.c.frombdb 2021-04-28 15:49:23.729883976 +0200 -+++ cyrus-sasl-2.1.27/sasldb/db_gdbm.c 2021-04-28 15:51:52.107086685 +0200 -@@ -99,6 +99,9 @@ int _sasldb_getdata(const sasl_utils_t * +--- cyrus-sasl-2.1.27/sasldb/db_gdbm.c.frombdb 2017-07-13 14:34:03.000000000 +0200 ++++ cyrus-sasl-2.1.27/sasldb/db_gdbm.c 2021-06-04 13:04:24.098206887 +0200 +@@ -67,6 +67,7 @@ int _sasldb_getdata(const sasl_utils_t * + void *cntxt; + sasl_getopt_t *getopt; + const char *path = SASL_DB_PATH; ++ int fetch_errno = 0; + + if (!utils) return SASL_BADPARAM; + if (!authid || !propName || !realm || !out || !max_out) { +@@ -99,6 +100,9 @@ int _sasldb_getdata(const sasl_utils_t * } db = gdbm_open((char *)path, 0, GDBM_READER, S_IRUSR | S_IWUSR, NULL); if (! db) { @@ -50,7 +58,19 @@ diff -up cyrus-sasl-2.1.27/sasldb/db_gdbm.c.frombdb cyrus-sasl-2.1.27/sasldb/db_ utils->seterror(cntxt, 0, "Could not open %s: gdbm_errno=%d", path, gdbm_errno); result = SASL_FAIL; -@@ -186,7 +189,8 @@ int _sasldb_putdata(const sasl_utils_t * +@@ -107,9 +111,10 @@ int _sasldb_getdata(const sasl_utils_t * + gkey.dptr = key; + gkey.dsize = key_len; + gvalue = gdbm_fetch(db, gkey); ++ 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); +@@ -186,7 +191,8 @@ int _sasldb_putdata(const sasl_utils_t * if (! db) { utils->log(conn, SASL_LOG_ERR, "SASL error opening password file. " diff --git a/cyrus-sasl.spec b/cyrus-sasl.spec index 8f6afbe..93c80a8 100644 --- a/cyrus-sasl.spec +++ b/cyrus-sasl.spec @@ -9,7 +9,7 @@ Summary: The Cyrus SASL library Name: cyrus-sasl Version: 2.1.27 -Release: 12%{?dist} +Release: 13%{?dist} License: BSD with advertising URL: https://www.cyrusimap.org/sasl/ @@ -393,6 +393,10 @@ getent passwd %{username} >/dev/null || useradd -r -g %{username} -d %{homedir} %{_sbindir}/sasl2-shared-mechlist %changelog +* Tue Aug 10 2021 Dmitry Belyavskiy - 2.1.27-13 +- Preserve GDBM error to correctly deal with GDBM sasldb +- Related: rhbz#1952926 + * Wed Jul 21 2021 Fedora Release Engineering - 2.1.27-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild