From 2b9a1feae7364a294b024dbeaf6a0202bbad468a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 11 May 2021 11:31:33 +0200 Subject: [PATCH] lib:util: Fix return value of tdb_fetch_uint32_byblob() The initialize_winbindd_cache() function uses tdb_fetch_uint32_byblob() to check if the cache version is valid and up to date. As tdb_fetch_uint32_byblob() returns false for a successful fetch, we always remove the winbind cache database. This breaks the winbind offline logon feature. This also affects other caches and pdb. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14702 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed May 12 21:19:03 UTC 2021 on sn-devel-184 --- lib/util/util_tdb.c | 7 ++++++- selftest/knownfail.d/offline_logon | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 selftest/knownfail.d/offline_logon diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c index 70eeceff391..b00b5039ec1 100644 --- a/lib/util/util_tdb.c +++ b/lib/util/util_tdb.c @@ -203,7 +203,12 @@ static bool tdb_fetch_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t *value) { int ret = tdb_parse_record(tdb, key, fetch_uint32_parser, value); - return ret; + + if (ret == -1) { + return false; + } + + return true; } /**************************************************************************** diff --git a/selftest/knownfail.d/offline_logon b/selftest/knownfail.d/offline_logon deleted file mode 100644 index ec258dedd1c..00000000000 --- a/selftest/knownfail.d/offline_logon +++ /dev/null @@ -1,4 +0,0 @@ -samba.blackbox.offline_logon.wbinfo.pam_logon_alice\(ad_member_offline_logon\) -samba.blackbox.offline_logon.wbinfo.pam_logon_bob\(ad_member_offline_logon\) -samba.blackbox.offline_logon.wbinfo.kerberos_logon_alice\(ad_member_offline_logon\) -samba.blackbox.offline_logon.wbinfo.kerberos_logon_bob\(ad_member_offline_logon\) -- 2.47.3