On (30/10/14 11:58), Pavel Reichl wrote:
> Hello,
>
> please see simple attached patch.
>
> Thanks!
>From ea19e0e615ce37353ffdece56e875d14bb882aa9 Mon Sep 17 00:00:00 2001
> From: Pavel Reichl <preichl(a)redhat.com>
> Date: Thu, 30 Oct 2014 11:54:54 +0000
> Subject: [PATCH] SYSDB: sysdb_idmap_get_mappings returns ENOENT
>
> sysdb_idmap_get_mappings returns ENOENT if no results were found.
>
> Part od solution for:
>
https://fedorahosted.org/sssd/ticket/1991
> ---
> src/db/sysdb_idmap.c | 11 +++++------
> src/tests/sysdb-tests.c | 6 ++++++
> 2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/src/db/sysdb_idmap.c b/src/db/sysdb_idmap.c
> index
7d342671b526099beaa461668fb6c58f73f5232a..bf7883a943b396da2ca400718ae882d70ddb55bb 100644
> --- a/src/db/sysdb_idmap.c
> +++ b/src/db/sysdb_idmap.c
> @@ -280,7 +280,6 @@ sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx,
> struct ldb_result **_result)
> {
> errno_t ret;
> - int lret;
> struct ldb_dn *base_dn;
> TALLOC_CTX *tmp_ctx;
> struct ldb_result *res;
> @@ -298,19 +297,19 @@ sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx,
> goto done;
> }
>
> - lret = ldb_search(domain->sysdb->ldb, tmp_ctx, &res, base_dn,
> - LDB_SCOPE_SUBTREE, attrs, SYSDB_IDMAP_FILTER);
> - if (lret) {
> + SSS_LDB_SEARCH(ret, domain->sysdb->ldb, tmp_ctx, &res, base_dn,
> + LDB_SCOPE_SUBTREE, attrs, SYSDB_IDMAP_FILTER);
> + if (ret != EOK) {
> DEBUG(SSSDBG_MINOR_FAILURE,
> "Could not locate ID mappings: [%s]\n",
> - ldb_strerror(lret));
> - ret = sysdb_error_to_errno(lret);
> + sss_strerror(ret));
^^^^^
Could you move this one space to left?
Indentation will be perfect after this change.
> goto done;
> }
>
> *_result = talloc_steal(mem_ctx, res);
>
> ret = EOK;
> +
> done:
> talloc_free(tmp_ctx);
> return ret;
Could you also change code in the function sdap_idmap_init
(src/providers/ldap/sdap_idmap.c)
At least, we can simplify next lines:
goto done;
}
- if (ret == EOK && res->count > 0) {
+ if (ret == EOK) {
DEBUG(SSSDBG_CONF_SETTINGS,
"Initializing [%d] domains for ID-mapping\n", res->count);
LS
_______________________________________________
sssd-devel mailing list
sssd-devel(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel