ipa_selinux_maps.c revision 64ddff90c7fcc02ccb06824ac93af7d5f361a88f
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny IPA Backend Module -- SELinux user maps (maps retrieval)
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny Jan Zeleny <jzeleny@redhat.com>
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny Copyright (C) 2012 Red Hat
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny This program is free software; you can redistribute it and/or modify
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny it under the terms of the GNU General Public License as published by
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny the Free Software Foundation; either version 3 of the License, or
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny (at your option) any later version.
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny This program is distributed in the hope that it will be useful,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny but WITHOUT ANY WARRANTY; without even the implied warranty of
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny GNU General Public License for more details.
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny You should have received a copy of the GNU General Public License
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny along with this program. If not, see <http://www.gnu.org/licenses/>.
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny const char **attrs;
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zelenyipa_selinux_get_maps_done(struct tevent_req *subreq);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zelenystruct tevent_req *ipa_selinux_get_maps_send(TALLOC_CTX *mem_ctx,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny req = tevent_req_create(mem_ctx, &state, struct ipa_selinux_get_maps_state);
fdab7bbf8933351f6254438c30ff361cd748b15aJan Zeleny ret = build_attrs_from_map(state, ipa_opts->selinuxuser_map,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny "(&(objectclass=%s)(%s=TRUE))",
fdab7bbf8933351f6254438c30ff361cd748b15aJan Zeleny ipa_opts->selinuxuser_map[IPA_OC_SELINUX_USERMAP].name,
fdab7bbf8933351f6254438c30ff361cd748b15aJan Zeleny ipa_opts->selinuxuser_map[IPA_AT_SELINUX_USERMAP_ENABLED].name);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny base = state->search_bases[state->search_base_iter];
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny state->cur_filter = sdap_get_id_specific_filter(state, state->maps_filter,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny DEBUG(SSSDBG_TRACE_FUNC, ("Trying to fetch SELinux maps with following "
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny subreq = sdap_get_generic_send(state, state->ev, state->opts,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny tevent_req_set_callback(subreq, ipa_selinux_get_maps_done, req);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zelenystatic void ipa_selinux_get_maps_done(struct tevent_req *subreq)
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny struct tevent_req *req = tevent_req_callback_data(subreq,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny struct ipa_selinux_get_maps_state *state = tevent_req_data(req,
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny ret = sdap_get_generic_recv(subreq, state, &count, &results);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny DEBUG(SSSDBG_TRACE_FUNC, ("Found %d user maps in current search base\n",
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny state->maps = talloc_realloc(state, state->maps, struct sysdb_attrs *, total_count);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny state->maps[state->map_count] = talloc_steal(state->maps, results[i]);
1a853121ca2ba8ede6df429ee76942131ffb0f65Jan Zeleny DEBUG(SSSDBG_TRACE_FUNC, ("No SELinux user maps found!\n"));