URL:
https://github.com/SSSD/sssd/pull/277
Title: #277: CACHE_REQ_SEARCH: Check for filtered users/groups also on cache_req_send()
pbrezina commented:
"""
I do not like having a temporary memory context inside `cache_req_search_send` and since
we are using `cache_req_search_ncache_filter` on two places now, I would like you to
change it a little bit so we have clear and unified usage.
The purpose of `cache_req_search_ncache_filter` is to sieve result from cache trough the
negative cache and return a new result. The reason why a temporary memory context is
needed here is that we return the original result as a "performance improvement"
and we do not know in the caller whether we created a new result or reused the original
one. We should not use the original result in the caller anymore regardless of what was
returned from the filter.
I propose the following change:
```c
static errno_t cache_req_search_ncache_filter(TALLOC_CTX *mem_ctx,
struct cache_req *cr,
struct ldb_result *result,
struct ldb_result **_result)
=>
static errno_t cache_req_search_ncache_filter(TALLOC_CTX *mem_ctx,
struct cache_req *cr,
struct ldb_result **_result)
```
The function will take an input/output argument `_result` and it will free the original
result if needed. Then a caller doesn't have to care about it at all.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/277#issuecomment-303375053