60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev Jan Zeleny <jzeleny@redhat.com>
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev Copyright (C) 2012 Red Hat
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev This program is free software; you can redistribute it and/or modify
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev it under the terms of the GNU General Public License as published by
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev the Free Software Foundation; either version 3 of the License, or
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev (at your option) any later version.
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev This program is distributed in the hope that it will be useful,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev but WITHOUT ANY WARRANTY; without even the implied warranty of
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev GNU General Public License for more details.
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev You should have received a copy of the GNU General Public License
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev along with this program. If not, see <http://www.gnu.org/licenses/>.
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* Return values */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev * hostname == NULL -> look up all hosts / host groups
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev * hostname != NULL -> look up only given host and groups
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev * it's member of
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev req = tevent_req_create(mem_ctx, &state, struct sdap_host_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = build_attrs_from_map(state, host_map, SDAP_OPTS_HOST,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state->host_filter = talloc_asprintf(state, "(objectClass=%s)",
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state->host_filter = talloc_asprintf(state, "(&(objectClass=%s)(%s=%s))",
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev DEBUG(SSSDBG_CRIT_FAILURE, "No host search base configured?\n");
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venevstatic errno_t sdap_host_info_next(struct tevent_req *req,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev base = state->search_bases[state->search_base_iter];
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state->cur_filter = sdap_combine_filters(state, state->host_filter,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev subreq = sdap_get_generic_send(state, state->ev, state->opts,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev DEBUG(SSSDBG_CRIT_FAILURE, "Error requesting host info\n");
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev tevent_req_set_callback(subreq, sdap_host_info_done, req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct sdap_host_state *state = tevent_req_data(req, struct sdap_host_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* No more search bases to try */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* Nothing else to do, just complete the req */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Veneverrno_t sdap_host_info_recv(struct tevent_req *req,