int ifp_req_create_handle_failure(struct sbus_request *dbus_req, errno_t err) { if (err == EACCES) { return sbus_request_fail_and_finish(dbus_req, sbus_error_new(dbus_req, DBUS_ERROR_ACCESS_DENIED, "User %"PRIi64" not in ACL\n", dbus_req->client)); } return sbus_request_fail_and_finish(dbus_req, sbus_error_new(dbus_req, DBUS_ERROR_FAILED, "Cannot create IFP request\n")); }
static void ifp_groups_find_by_name_done(struct tevent_req *req) { DBusError *error; struct sbus_request *sbus_req; struct sss_domain_info *domain; struct ldb_result *result; char *object_path; errno_t ret; sbus_req = tevent_req_callback_data(req, struct sbus_request); ret = cache_req_group_by_name_recv(sbus_req, req, &result, &domain, NULL); talloc_zfree(req); if (ret == ENOENT) { error = sbus_error_new(sbus_req, SBUS_ERROR_NOT_FOUND, "Group not found"); goto done; } else if (ret != EOK) { error = sbus_error_new(sbus_req, DBUS_ERROR_FAILED, "Failed to fetch " "group [%d]: %s\n", ret, sss_strerror(ret)); goto done; } object_path = ifp_groups_build_path_from_msg(sbus_req, domain, result->msgs[0]); if (object_path == NULL) { error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, "Failed to compose object path"); goto done; } ret = EOK; done: if (ret != EOK) { sbus_request_fail_and_finish(sbus_req, error); return; } iface_ifp_groups_FindByName_finish(sbus_req, object_path); return; }
static void ifp_groups_list_by_domain_and_name_done(struct tevent_req *req) { DBusError *error; struct ifp_list_ctx *list_ctx; struct sbus_request *sbus_req; struct ldb_result *result; struct sss_domain_info *domain; errno_t ret; list_ctx = tevent_req_callback_data(req, struct ifp_list_ctx); sbus_req = list_ctx->sbus_req; ret = cache_req_user_by_name_recv(sbus_req, req, &result, &domain, NULL); talloc_zfree(req); if (ret == ENOENT) { error = sbus_error_new(sbus_req, SBUS_ERROR_NOT_FOUND, "User not found by filter"); goto done; } else if (ret != EOK) { error = sbus_error_new(sbus_req, DBUS_ERROR_FAILED, "Failed to fetch " "groups by filter [%d]: %s\n", ret, sss_strerror(ret)); goto done; } ret = ifp_groups_list_copy(list_ctx, result); if (ret != EOK) { error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, "Failed to copy domain result"); goto done; } done: if (ret != EOK) { sbus_request_fail_and_finish(sbus_req, error); return; } iface_ifp_groups_ListByDomainAndName_finish(sbus_req, list_ctx->paths, list_ctx->path_count); return; }
static void ifp_groups_list_by_name_done(struct tevent_req *req) { DBusError *error; struct ifp_list_ctx *list_ctx; struct sbus_request *sbus_req; struct ldb_result *result; struct sss_domain_info *domain; errno_t ret; list_ctx = tevent_req_callback_data(req, struct ifp_list_ctx); sbus_req = list_ctx->sbus_req; ret = cache_req_group_by_name_recv(sbus_req, req, &result, &domain, NULL); talloc_zfree(req); if (ret != EOK && ret != ENOENT) { error = sbus_error_new(sbus_req, DBUS_ERROR_FAILED, "Failed to fetch " "groups by filter [%d]: %s\n", ret, sss_strerror(ret)); sbus_request_fail_and_finish(sbus_req, error); return; } ret = ifp_groups_list_copy(list_ctx, result); if (ret != EOK) { error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, "Failed to copy domain result"); sbus_request_fail_and_finish(sbus_req, error); return; } list_ctx->dom = get_next_domain(list_ctx->dom, SSS_GND_DESCEND); if (list_ctx->dom == NULL) { return ifp_groups_list_by_name_reply(list_ctx); } ret = ifp_groups_list_by_name_step(list_ctx); if (ret != EOK) { error = sbus_error_new(sbus_req, SBUS_ERROR_INTERNAL, "Failed to start next-domain search"); sbus_request_fail_and_finish(sbus_req, error); return; } }