URL:
https://github.com/SSSD/sssd/pull/246
Title: #246: filter_users and filter_groups stop working properly in v 1.15
pbrezina commented:
"""
* **CACHE_REQ: Add a new cache_req_ncache_filter_fn() plugin function**
```c
/**
+ * Filter the result through the negative cache.
+ *
+ * This is useful for plugins which don't use name as an input
+ * takes but can be affected by filter_users and filter_groups
^ token
+ * options.
+ */
+typedef errno_t
+(*cache_req_ncache_filter_fn)(struct sss_nc_ctx *ncache,
+ struct sss_domain_info *domain,
+ const char *name);
+
+/**
```
* **CACHE_REQ: Make use of cache_req_ncache_filter_fn()**
Since the original result may be theoretically quite big, we should free it in
`cache_req_search_done` after we obtain the filtered result and use `talloc_steal` in
`cache_req_search_ncache_filter` to steal the messages on new context. i.e.
```c
msgs[msg_count] = talloc_steal(msgs, result->msgs[i]);
msg_count++
```
And also use `tmp_ctx` for filtered result and then steal it (for clarity):
```c
+ filtered_result = cache_req_create_ldb_result_from_msg_list(mem_ctx, msgs,
+ msg_count);
^ tmp_ctx here
+ if (filtered_result == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ *_result = filtered_result;
^ *_result = talloc_steal(mem_ctx, filtered_result)
```
Besides those nitpicks, the patches are good to go.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/246#issuecomment-298595083