diff options
Diffstat (limited to 'src/db')
| -rw-r--r-- | src/db/sysdb.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index 1f02585e..61a22400 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -1508,6 +1508,7 @@ errno_t sysdb_get_bool(struct sysdb_ctx *sysdb, errno_t ret; int lret; const char *attrs[2] = {attr_name, NULL}; + struct ldb_message_element *el; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -1530,7 +1531,7 @@ errno_t sysdb_get_bool(struct sysdb_ctx *sysdb, * to contain this attribute. */ *value = false; - ret = EOK; + ret = ENOENT; goto done; } else if (res->count != 1) { DEBUG(SSSDBG_CRIT_FAILURE, @@ -1539,6 +1540,12 @@ errno_t sysdb_get_bool(struct sysdb_ctx *sysdb, goto done; } + el = ldb_msg_find_element(res->msgs[0], attr_name); + if (el == NULL || el->num_values == 0) { + ret = ENOENT; + goto done; + } + *value = ldb_msg_find_attr_as_bool(res->msgs[0], attr_name, false); ret = EOK; |
