diff options
author | Sumit Bose <sbose@redhat.com> | 2017-05-08 17:30:06 +0200 |
---|---|---|
committer | Lukas Slebodnik <lslebodn@redhat.com> | 2017-06-01 16:49:59 +0200 |
commit | ee7e72a65d323636600ffda271d5b5c4ddbc78b1 (patch) | |
tree | 80ec58ac4f2d1eb8ccf54f502567a7ec556c134c /src/db | |
parent | 32474fa2f0a6dc09386bab405fc3461cb3dd12ac (diff) | |
download | sssd-ee7e72a65d323636600ffda271d5b5c4ddbc78b1.tar.gz sssd-ee7e72a65d323636600ffda271d5b5c4ddbc78b1.tar.xz sssd-ee7e72a65d323636600ffda271d5b5c4ddbc78b1.zip |
sysdb: sysdb_get_certmap() allow empty certmap
Since sysdb_get_certmap() returns the user name hint information as well
it should return a result even if there are no certmaps.
Related to https://pagure.io/SSSD/sssd/issue/3395
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb_certmap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/db/sysdb_certmap.c b/src/db/sysdb_certmap.c index 4917796b1..2d89c08a0 100644 --- a/src/db/sysdb_certmap.c +++ b/src/db/sysdb_certmap.c @@ -269,7 +269,7 @@ errno_t sysdb_get_certmap(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, size_t d; struct ldb_dn *container_dn = NULL; int ret; - struct certmap_info **maps; + struct certmap_info **maps = NULL; TALLOC_CTX *tmp_ctx = NULL; struct ldb_result *res; const char *tmp_str; @@ -320,7 +320,7 @@ errno_t sysdb_get_certmap(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, if (res->count == 0) { DEBUG(SSSDBG_TRACE_FUNC, "No certificate maps found.\n"); - ret = ENOENT; + ret = EOK; goto done; } @@ -377,7 +377,7 @@ errno_t sysdb_get_certmap(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, SYSDB_CERTMAP_PRIORITY, (uint64_t) -1); if (tmp_uint != (uint64_t) -1) { - if (tmp_uint >= UINT32_MAX) { + if (tmp_uint > UINT32_MAX) { DEBUG(SSSDBG_OP_FAILURE, "Priority value [%lu] too large.\n", (unsigned long) tmp_uint); ret = EINVAL; @@ -414,11 +414,14 @@ errno_t sysdb_get_certmap(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, } } - *certmaps = talloc_steal(mem_ctx, maps); - *user_name_hint = hint; ret = EOK; done: + if (ret == EOK) { + *certmaps = talloc_steal(mem_ctx, maps); + *user_name_hint = hint; + } + talloc_free(tmp_ctx); return ret; |