83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina/*
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Authors:
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Pavel Březina <pbrezina@redhat.com>
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Copyright (C) 2016 Red Hat
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina This program is free software; you can redistribute it and/or modify
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina it under the terms of the GNU General Public License as published by
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina the Free Software Foundation; either version 3 of the License, or
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina (at your option) any later version.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina This program is distributed in the hope that it will be useful,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina GNU General Public License for more details.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina You should have received a copy of the GNU General Public License
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina*/
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "responder/common/data_provider/rdp.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "util/util.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinastatic void rdp_register_client_done(struct tevent_req *req);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinaerrno_t rdp_register_client(struct be_conn *be_conn,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina const char *client_name)
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina{
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina struct tevent_req *req;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina req = rdp_message_send(be_conn, be_conn->rctx, be_conn->domain,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina DP_PATH, IFACE_DP_CLIENT, IFACE_DP_CLIENT_REGISTER,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina DBUS_TYPE_STRING, &client_name);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina if (req == NULL) {
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina return ENOMEM;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina }
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina tevent_req_set_callback(req, rdp_register_client_done, NULL);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina return EOK;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina}
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinastatic void rdp_register_client_done(struct tevent_req *req)
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina{
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina errno_t ret;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina ret = rdp_message_recv(req);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina talloc_zfree(req);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina if (ret != EOK) {
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to register client with DP\n");
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina return;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina }
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina DEBUG(SSSDBG_TRACE_FUNC, "Client is registered with DP\n");
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina}