Skip to content

Commit

Permalink
db_gdbm: fix gdbm_errno overlay from gdbm_close
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
TheJJ authored and quanah committed Feb 18, 2020
1 parent 0c67d30 commit a7b92c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sasldb/db_gdbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a7b92c8

Please sign in to comment.