gdbm-errno.patch 1.0 KB

123456789101112131415161718192021222324252627282930
  1. From af48f6fec9a7b6374d4153c5db894d4a1f349645 Mon Sep 17 00:00:00 2001
  2. From: Jonas Jelten <jj@sft.mx>
  3. Date: Sat, 2 Feb 2019 20:53:37 +0100
  4. Subject: [PATCH] db_gdbm: fix gdbm_errno overlay from gdbm_close
  5. `gdbm_close` also sets gdbm_errno since version 1.17.
  6. This leads to a problem in `libsasl` as the `gdbm_close` incovation overlays
  7. the `gdbm_errno` value which is then later used for the error handling.
  8. ---
  9. sasldb/db_gdbm.c | 4 +++-
  10. 1 file changed, 3 insertions(+), 1 deletion(-)
  11. diff --git a/sasldb/db_gdbm.c b/sasldb/db_gdbm.c
  12. index ee56a6bf..c908808e 100644
  13. --- a/sasldb/db_gdbm.c
  14. +++ b/sasldb/db_gdbm.c
  15. @@ -107,9 +107,11 @@ int _sasldb_getdata(const sasl_utils_t *utils,
  16. gkey.dptr = key;
  17. gkey.dsize = key_len;
  18. gvalue = gdbm_fetch(db, gkey);
  19. + int fetch_errno = gdbm_errno;
  20. +
  21. gdbm_close(db);
  22. if (! gvalue.dptr) {
  23. - if (gdbm_errno == GDBM_ITEM_NOT_FOUND) {
  24. + if (fetch_errno == GDBM_ITEM_NOT_FOUND) {
  25. utils->seterror(conn, SASL_NOLOG,
  26. "user: %s@%s property: %s not found in %s",
  27. authid, realm, propName, path);