e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta/*
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta Authors:
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta Jan Cholasta <jcholast@redhat.com>
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta Copyright (C) 2012 Red Hat
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta This program is free software; you can redistribute it and/or modify
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta it under the terms of the GNU General Public License as published by
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta the Free Software Foundation; either version 3 of the License, or
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta (at your option) any later version.
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta This program is distributed in the hope that it will be useful,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta but WITHOUT ANY WARRANTY; without even the implied warranty of
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta GNU General Public License for more details.
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta You should have received a copy of the GNU General Public License
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta along with this program. If not, see <http://www.gnu.org/licenses/>.
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta*/
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include <popt.h>
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include "util/util.h"
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include "confdb/confdb.h"
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include "monitor/monitor_interfaces.h"
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include "responder/common/responder.h"
e880949305cee3aca79441fe6113a9d79e7c98f2Jakub Hrozek#include "responder/common/responder_sbus.h"
a8191ce7ad5364801ad9458c3194075a7ca77b8aPavel Březina#include "responder/ssh/ssh_private.h"
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta#include "providers/data_provider.h"
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
769347ad4d35d43488eb98f980143495b0db415dStef Walterstruct mon_cli_iface monitor_ssh_methods = {
769347ad4d35d43488eb98f980143495b0db415dStef Walter { &mon_cli_iface_meta, 0 },
769347ad4d35d43488eb98f980143495b0db415dStef Walter .resInit = monitor_common_res_init,
769347ad4d35d43488eb98f980143495b0db415dStef Walter .goOffline = NULL,
769347ad4d35d43488eb98f980143495b0db415dStef Walter .resetOffline = NULL,
769347ad4d35d43488eb98f980143495b0db415dStef Walter .rotateLogs = responder_logrotate,
769347ad4d35d43488eb98f980143495b0db415dStef Walter .clearMemcache = NULL,
769347ad4d35d43488eb98f980143495b0db415dStef Walter .clearEnumCache = NULL,
b76419cf8830440b46c20a15585562343c7b1924Jakub Hrozek .sysbusReconnect = NULL,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta};
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholastastatic void ssh_dp_reconnect_init(struct sbus_connection *conn,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int status, void *pvt)
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta{
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int ret;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* Did we reconnect successfully? */
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (status == SBUS_RECONNECT_SUCCESS) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_TRACE_FUNC, "Reconnected to the Data Provider.\n");
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* Identify ourselves to the data provider */
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina ret = rdp_register_client(be_conn, "SSH");
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* all fine */
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret == EOK) {
65976ea5e9767bfaced81dfb97dc87d59f50b57eSimo Sorce handle_requests_after_reconnect(be_conn->rctx);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* Failed to reconnect */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n",
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov be_conn->domain->name);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta}
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholastaint ssh_process_init(TALLOC_CTX *mem_ctx,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct tevent_context *ev,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct confdb_ctx *cdb)
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta{
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina struct resp_ctx *rctx;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct sss_cmd_table *ssh_cmds;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct ssh_ctx *ssh_ctx;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct be_conn *iter;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int ret;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int max_retries;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ssh_cmds = get_ssh_cmds();
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina ret = sss_process_init(mem_ctx, ev, cdb,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ssh_cmds,
8bccd95e275fae760a991da394235e4e70e57bbdMichal Zidek SSS_SSH_SOCKET_NAME, -1, NULL, -1,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta CONFDB_SSH_CONF_ENTRY,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta SSS_SSH_SBUS_SERVICE_NAME,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta SSS_SSH_SBUS_SERVICE_VERSION,
07e941c1bbdc752142bbd3b838c540bc7ecd0ed7Stef Walter &monitor_ssh_methods,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta "SSH",
04e870d99e72aa3160bdb6ab05d986fb4005c3edPavel Březina NULL,
4f3a9d837a55b49448eca3c713c85a406207e523Simo Sorce sss_connection_setup,
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina &rctx);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret != EOK) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n");
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina return ret;
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina }
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina ssh_ctx = talloc_zero(rctx, struct ssh_ctx);
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina if (!ssh_ctx) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing ssh_ctx\n");
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina ret = ENOMEM;
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina goto fail;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina ssh_ctx->rctx = rctx;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ssh_ctx->rctx->pvt_ctx = ssh_ctx;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta ret = sss_names_init_from_args(ssh_ctx,
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta "(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta "%1$s@%2$s", &ssh_ctx->snctx);
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta if (ret != EOK) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing regex data\n");
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta goto fail;
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta }
728b10c81204929be5669c1e67bd086e09c47c00Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* Enable automatic reconnection to the Data Provider */
3bea01f01d76e1e95a8239c0d3f67073992136a1Jan Zeleny ret = confdb_get_int(ssh_ctx->rctx->cdb,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta CONFDB_SSH_CONF_ENTRY,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta CONFDB_SERVICE_RECON_RETRIES,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta 3, &max_retries);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret != EOK) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta DEBUG(SSSDBG_FATAL_FAILURE,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov "Failed to set up automatic reconnection\n");
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina goto fail;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta for (iter = ssh_ctx->rctx->be_conns; iter; iter = iter->next) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta sbus_reconnect_init(iter->conn, max_retries,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ssh_dp_reconnect_init, iter);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta /* Get responder options */
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta /* Get ssh_hash_known_hosts option */
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta ret = confdb_get_bool(ssh_ctx->rctx->cdb,
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta CONFDB_SSH_CONF_ENTRY, CONFDB_SSH_HASH_KNOWN_HOSTS,
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta CONFDB_DEFAULT_SSH_HASH_KNOWN_HOSTS,
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta &ssh_ctx->hash_known_hosts);
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta if (ret != EOK) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n",
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov ret, strerror(ret));
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina goto fail;
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta }
4fa3ef8d8a8a3cddf8025d306c3b90b37dd431bcJan Cholasta
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta /* Get ssh_known_hosts_timeout option */
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta ret = confdb_get_int(ssh_ctx->rctx->cdb,
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta CONFDB_SSH_CONF_ENTRY, CONFDB_SSH_KNOWN_HOSTS_TIMEOUT,
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta CONFDB_DEFAULT_SSH_KNOWN_HOSTS_TIMEOUT,
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta &ssh_ctx->known_hosts_timeout);
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta if (ret != EOK) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n",
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov ret, strerror(ret));
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina goto fail;
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta }
3882325ff60f89d0c312e9519bdfd1351978fd73Jan Cholasta
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose ret = confdb_get_string(ssh_ctx->rctx->cdb, ssh_ctx,
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose CONFDB_SSH_CONF_ENTRY, CONFDB_SSH_CA_DB,
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose CONFDB_DEFAULT_SSH_CA_DB, &ssh_ctx->ca_db);
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose if (ret != EOK) {
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose DEBUG(SSSDBG_FATAL_FAILURE, "Error reading CA DB from confdb (%d) [%s]\n",
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose ret, strerror(ret));
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose goto fail;
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose }
4de84af23db74e13e867985c9093f394c9fa8d51Sumit Bose
0528fdec17d0031996e919fcd852459e86592c35Jakub Hrozek ret = schedule_get_domains_task(rctx, rctx->ev, rctx, NULL);
909a86af4eb99f5d311d7136cab78dca535ae304Sumit Bose if (ret != EOK) {
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "schedule_get_domains_tasks failed.\n");
909a86af4eb99f5d311d7136cab78dca535ae304Sumit Bose goto fail;
909a86af4eb99f5d311d7136cab78dca535ae304Sumit Bose }
909a86af4eb99f5d311d7136cab78dca535ae304Sumit Bose
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_TRACE_FUNC, "SSH Initialization complete\n");
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return EOK;
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březinafail:
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina talloc_free(rctx);
6f8ae17869f4f8a1496e3f171ae6b5c11af1845cPavel Březina return ret;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta}
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholastaint main(int argc, const char *argv[])
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta{
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int opt;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta poptContext pc;
cb75b275d15beedd1fdecc1f8ced657fba282218Lukas Slebodnik char *opt_logger = NULL;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct main_context *main_ctx;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta int ret;
ac40d2f2b2b2fc35c95389f5e28febd580bd2b7aJakub Hrozek uid_t uid;
ac40d2f2b2b2fc35c95389f5e28febd580bd2b7aJakub Hrozek gid_t gid;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta struct poptOption long_options[] = {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta POPT_AUTOHELP
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta SSSD_MAIN_OPTS
cb75b275d15beedd1fdecc1f8ced657fba282218Lukas Slebodnik SSSD_LOGGER_OPTS
ac40d2f2b2b2fc35c95389f5e28febd580bd2b7aJakub Hrozek SSSD_SERVER_OPTS(uid, gid)
b33c275ebac86695f7a2fa866e5766d469e2c578Fabiano Fidêncio SSSD_RESPONDER_OPTS
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta POPT_TABLEEND
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta };
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
677a31351c80453d9ce006481364399a96312052René Genz /* Set debug level to invalid value so we can decide if -d 0 was used. */
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta debug_level = SSSDBG_INVALID;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
458f5245dd5130d12666cce6faf8ef1ec7f80169Pavel Reichl umask(DFL_RSP_UMASK);
458f5245dd5130d12666cce6faf8ef1ec7f80169Pavel Reichl
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta pc = poptGetContext(argv[0], argc, argv, long_options, 0);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta while((opt = poptGetNextOpt(pc)) != -1) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta switch(opt) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta default:
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta fprintf(stderr, "\nInvalid option %s: %s\n\n",
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta poptBadOption(pc, 0), poptStrerror(opt));
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta poptPrintUsage(pc, stderr, 0);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return 1;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta poptFreeContext(pc);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
9e2c64c6d4f5560e27207193efea6536a566865eMichal Zidek DEBUG_INIT(debug_level);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
677a31351c80453d9ce006481364399a96312052René Genz /* set up things like debug, signals, daemonization, etc. */
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta debug_log_file = "sssd_ssh";
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
cb75b275d15beedd1fdecc1f8ced657fba282218Lukas Slebodnik sss_set_logger(opt_logger);
cb75b275d15beedd1fdecc1f8ced657fba282218Lukas Slebodnik
76c8dafad2a18cf1514635aa766062085c23a5c8Jakub Hrozek ret = server_setup("sssd[ssh]", 0, uid, gid,
76c8dafad2a18cf1514635aa766062085c23a5c8Jakub Hrozek CONFDB_SSH_CONF_ENTRY, &main_ctx);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret != EOK) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return 2;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ret = die_if_parent_died();
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret != EOK) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* This is not fatal, don't return */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_OP_FAILURE, "Could not set up to exit "
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov "when parent process does\n");
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta ret = ssh_process_init(main_ctx,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta main_ctx->event_ctx,
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta main_ctx->confdb_ctx);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta if (ret != EOK) {
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return 3;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta }
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta /* loop on main */
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta server_loop(main_ctx);
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta return 0;
e7311aec8d691e5427317442387af1bc8fff3742Jan Cholasta}