ipa_hostid.c revision 2d6836a90bd326391782a5753f70e8ba666b5def
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor Jan Cholasta <jcholast@redhat.com>
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor Copyright (C) 2012 Red Hat
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor This program is free software; you can redistribute it and/or modify
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor it under the terms of the GNU General Public License as published by
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor the Free Software Foundation; either version 3 of the License, or
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor (at your option) any later version.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen This program is distributed in the hope that it will be useful,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen but WITHOUT ANY WARRANTY; without even the implied warranty of
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor GNU General Public License for more details.
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen You should have received a copy of the GNU General Public License
3f08db06526d6901aa08c110b5bc7dde6bc39905nd along with this program. If not, see <http://www.gnu.org/licenses/>.
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *name;
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *alias;
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *name,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *alias);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor hostid_ctx = talloc_get_type(breq->be_ctx->bet_info[BET_HOSTID].pvt_bet_data, struct ipa_hostid_ctx);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor hr = talloc_get_type(breq->req_data, struct be_host_req);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor req = hosts_get_send(breq, breq->be_ctx->ev, hostid_ctx,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor tevent_req_set_callback(req, ipa_host_info_hosts_done, breq);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor if (ret != EOK) return sdap_handler_done(breq, dp_error, ret, err);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzoripa_host_info_complete(struct be_req *breq, int dp_error,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char* error_text;
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor ("Bug: dp_error is OK on failed request"));
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor } else if (dp_error == DP_ERR_FATAL && ret == ENOMEM) {
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor struct be_req *breq = tevent_req_callback_data(req, struct be_req);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor ipa_host_info_complete(breq, dp_error, ret, "Host lookup failed");
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *name,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor const char *alias)
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor req = tevent_req_create(memctx, &state, struct hosts_get_state);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor state->op = sdap_id_op_create(state, ctx->conn_cache);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor DEBUG(SSSDBG_OP_FAILURE, ("sdap_id_op_create failed\n"));
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor subreq = sdap_id_op_connect_send(state->op, state, &ret);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor tevent_req_set_callback(subreq, hosts_get_connect_done, req);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor struct tevent_req *req = tevent_req_callback_data(subreq,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor subreq = ipa_host_info_send(state, state->ev, state->sysdb,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor tevent_req_set_callback(subreq, hosts_get_done, req);
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor struct tevent_req *req = tevent_req_callback_data(subreq,
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor /* retry */
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor ("Found more than one host with name [%s].\n", state->name));
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor /* we are interested only in the host keys */
293aa6caecb1db771e9baa2f79c92f1c381caee4gryzor ret = sysdb_attrs_copy_values(state->hosts[0], attrs, SYSDB_SSH_PUBKEY);