60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev Jan Cholasta <jcholast@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 Venevhosts_get_connect_done(struct tevent_req *subreq);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev const char *name,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev req = tevent_req_create(memctx, &state, struct hosts_get_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state->op = sdap_id_op_create(state, id_ctx->conn->conn_cache);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev DEBUG(SSSDBG_OP_FAILURE, "sdap_id_op_create failed\n");
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct hosts_get_state *state = tevent_req_data(req,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev subreq = sdap_id_op_connect_send(state->op, state, &ret);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev tevent_req_set_callback(subreq, hosts_get_connect_done, req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venevhosts_get_connect_done(struct tevent_req *subreq)
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct tevent_req *req = tevent_req_callback_data(subreq,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct hosts_get_state *state = tevent_req_data(req,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = sdap_id_op_connect_recv(subreq, &dp_error);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev tevent_req_set_callback(subreq, hosts_get_done, req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct tevent_req *req = tevent_req_callback_data(subreq,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct hosts_get_state *state = tevent_req_data(req,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = sdap_id_op_done(state->op, ret, &dp_error);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev "No host with name [%s] found.\n", state->name);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = sysdb_delete_ssh_host(state->domain, state->name);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev "Found more than one host with name [%s].\n", state->name);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* we are interested only in the host keys */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = sysdb_attrs_copy_values(state->hosts[0], attrs, SYSDB_SSH_PUBKEY);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev ret = sysdb_store_ssh_host(state->domain, state->name, state->alias,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct hosts_get_state *state = tevent_req_data(req,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venevstatic void sdap_hostid_handler_done(struct tevent_req *subreq);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev req = tevent_req_create(mem_ctx, &state, struct sdap_hostid_handler_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev subreq = hosts_get_send(state, params->ev, id_ctx,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev DEBUG(SSSDBG_CRIT_FAILURE, "Unable to send request\n");
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev tevent_req_set_callback(subreq, sdap_hostid_handler_done, req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev dp_reply_std_set(&state->reply, DP_ERR_DECIDE, ret, NULL);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* TODO For backward compatibility we always return EOK to DP now. */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venevstatic void sdap_hostid_handler_done(struct tevent_req *subreq)
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev req = tevent_req_callback_data(subreq, struct tevent_req);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state = tevent_req_data(req, struct sdap_hostid_handler_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev /* TODO For backward compatibility we always return EOK to DP now. */
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev dp_reply_std_set(&state->reply, dp_error, ret, NULL);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct sdap_hostid_handler_state *state = NULL;
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev state = tevent_req_data(req, struct sdap_hostid_handler_state);
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev sdap_hostid_handler_send, sdap_hostid_handler_recv, id_ctx,
60a715a0dd79873d2d2607eab8fdfaf0ffd2e7d3Hristo Venev struct sdap_id_ctx, struct dp_hostid_data, struct dp_reply_std);