d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina Pavel Březina <pbrezina@redhat.com>
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina Copyright (C) 2016 Red Hat
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina This program is free software; you can redistribute it and/or modify
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina it under the terms of the GNU General Public License as published by
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina the Free Software Foundation; either version 3 of the License, or
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina (at your option) any later version.
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina This program is distributed in the hope that it will be useful,
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina GNU General Public License for more details.
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina You should have received a copy of the GNU General Public License
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina#include "providers/data_provider/dp_private.h"
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březinastatic errno_t dp_init_dbus_server(struct data_provider *provider)
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina ret = dp_get_sbus_address(NULL, &sbus_address, domain);
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina DEBUG(SSSDBG_FATAL_FAILURE, "Could not get sbus backend address.\n");
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina ret = sbus_new_server(provider, provider->ev, sbus_address,
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina DEBUG(SSSDBG_FATAL_FAILURE, "Could not set up sbus server.\n");
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březinastatic int dp_destructor(struct data_provider *provider)
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina for (client = 0; client != DP_CLIENT_SENTINEL; client++) {
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina provider = talloc_zero(be_ctx, struct data_provider);
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina /* Initialize request table. */
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina ret = dp_req_table_init(provider, &provider->requests.reply_table);
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to initialize request table "
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina /* Initialize data provider bus. Data provider can receive client
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina * registration and other D-Bus methods. However no data provider
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina * request will be executed as long as the modules and targets
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina * are not initialized.
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina talloc_set_destructor(provider, dp_destructor);
a16e7a370d0b564a5edad7791d2421d175c0787aPavel Březina DEBUG(SSSDBG_FATAL_FAILURE, "Unable to setup service bus [%d]: %s\n",
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina ret = dp_init_modules(provider, &provider->modules);
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to initialize DP modules "
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina ret = dp_init_targets(provider, be_ctx, provider, provider->modules);
d3dee2a07f1a8ee9ae6f94e149ced754ef76c248Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to initialize DP targets "