History log of /sssd-io/src/responder/nss/nss_enum.c
Revision Date Author Comments Expand
08db22b1b1a2e742edbca92e35087294d963adda 10-Apr-2018 Sumit Bose <sbose@redhat.com>

nss: add a netgroup counter to struct nss_enum_index Netgroups are not looked up with the help of a single request but by calling setnetgrent(), getnetgrent() and endnetgrent() where getnetgrent() might be called multiple times depending on the number of netgroup elements. Since the caller does not provide a state the state has to be maintained by the SSSD nss responder. Besides the netgroup name this is mainly the number of elements already returned. This number is used to select the next element to return and currently it is assumed that there are not changes to the netgroup while the client is requesting the individual elements. But if e.g. the 3 nss calls are not used correctly or the netgroup is modified while the client is sending getnetgrent() calls the stored number might be out of range. To be on the safe side the stored number should be always compared with the current number of netgroup elements. Related to https://pagure.io/SSSD/sssd/issue/3679 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

f22528922c065f37ca928f95fd86ed2ea79e0d51 04-Apr-2018 Jakub Hrozek <jhrozek@redhat.com>

NSS: Adjust netgroup setnetgrent cache lifetime if midpoint refresh is used This is a minor regression compared to the state of the code before we converted the responders to cache_req. The NSS responder keeps a has table of netgroup objects in memory for either the lifetime of the netgroup, or, in case midpoint refresh is used, up to the midpoint refresh time. The case with the midpoint refresh was removed in the cache_req enabled code, which means that even if the netgroup was updated in the cache with the background refresh task, the object was never read from cache, but always still returned from the in-memory enumeration hash. Resolves: https://pagure.io/SSSD/sssd/issue/3550 Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

f6a1cef87abdd983d6b5349cd341c9a249826577 13-Nov-2017 Sumit Bose <sbose@redhat.com>

NSS: Use enum_ctx as memory_context in _setnetgrent_set_timeout() We've noticed some crashes that happened because enum_ctx is already freed, but the timeout handler is still called. In order to avoid that, let's remove the timeout handler when enum_ctx is freed at other places. Resolves: https://pagure.io/SSSD/sssd/issue/3523 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

cee85e8fb9534ec997e5388fce59f392cf029573 30-Mar-2017 Jakub Hrozek <jhrozek@redhat.com>

CACHE_REQ: Domain type selection in cache_req Related to: https://pagure.io/SSSD/sssd/issue/3310 Adds a new enumeration cache_req_dom_type. It is a tri-state that allows the caller to select which domains can be contacted - either only POSIX, only application domains or any type. Not all plugins of cache_req have the new parameter added -- only those that are usable/useful in a non-POSIX environment. For example, it makes no sense to allow the selection for calls by ID because those are inherently POSIX-specific. Also, services or netgroups are supported only coming from POSIX domains. At the moment, the patch should not change any behaviour as all calls default to contacting POSIX domains only. Reviewed-by: Pavel Březina <pbrezina@redhat.com>

/sssd-io/src/responder/common/cache_req/cache_req.c /sssd-io/src/responder/common/cache_req/cache_req.h /sssd-io/src/responder/common/cache_req/cache_req_private.h /sssd-io/src/responder/common/cache_req/plugins/cache_req_enum_groups.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_enum_svc.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_enum_users.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_group_by_filter.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_group_by_id.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_group_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_host_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_initgroups_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_netgroup_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_object_by_id.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_object_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_object_by_sid.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_svc_by_name.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_svc_by_port.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_user_by_cert.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_user_by_filter.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_user_by_id.c /sssd-io/src/responder/common/cache_req/plugins/cache_req_user_by_name.c /sssd-io/src/responder/ifp/ifp_groups.c /sssd-io/src/responder/ifp/ifp_users.c /sssd-io/src/responder/ifp/ifpsrv_cmd.c nss_enum.c nss_get_object.c /sssd-io/src/responder/pam/pamsrv_cmd.c /sssd-io/src/responder/sudo/sudosrv_get_sudorules.c /sssd-io/src/tests/cmocka/test_responder_cache_req.c
4049b63f8c67ada17b453463b0451ca6be3d5de4 19-Dec-2016 Pavel Březina <pbrezina@redhat.com>

nss: rewrite nss responder so it uses cache_req Given the size of the current nss responder it was quite impossible to simply switch into using the cache_req interface, especially because most of the code was duplication of cache lookups. This patch completely rewrites the responder from scratch. The amount of code was reduced to less than a half lines of code with no code duplication, better documentation and better maintainability and readability. All functionality should be intact. *Code organization* All protocol (parsing input message and send a reply) is placed in nss_protocol.c. Functions that deals with creating a reply packet are placed into their specific nss_protocol_$object.c files. All supported commands are placed into nss_cmd.c. Functions that deals with cache req are in nss_get_object.c and nss_enum.c. *Code flow for non-enumeration* An nss_getby_$input-type is called for each non-enumeration command. This function parses the input message, creates a cache_req_data structure and issues nss_get_object that calls cache_req. When this request is done nss_getby_done make sure a reply is sent to the client. *Comments on enumeration* I made some effort to make sure enumeration shares the same code for users, groups, services and netgroups. Netgroups now uses nss negative cache instead of implementing its own. Resolves: https://fedorahosted.org/sssd/ticket/3151 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>