autofssrv.c revision ab792150c97bd6eba1f8cd46653f41a0c64fd765
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder/*
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly Authors:
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly Jakub Hrozek <jhrozek@redhat.com>
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly Copyright (C) 2012 Red Hat
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly Autofs responder: the responder server
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly This program is free software; you can redistribute it and/or modify
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly it under the terms of the GNU General Public License as published by
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly the Free Software Foundation; either version 3 of the License, or
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly (at your option) any later version.
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly This program is distributed in the hope that it will be useful,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly but WITHOUT ANY WARRANTY; without even the implied warranty of
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder GNU General Public License for more details.
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly You should have received a copy of the GNU General Public License
7d41a06add784ca68e6507ce832e621a1d2abf49Christian Maeder along with this program. If not, see <http://www.gnu.org/licenses/>.
43e4005c54870e481df3a9be0f041caefe0c6eb5Christian Maeder*/
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#include <popt.h>
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder#include "util/util.h"
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder#include "confdb/confdb.h"
036ecbd8f721096321f47cf6a354a9d1bf3d032fChristian Maeder#include "monitor/monitor_interfaces.h"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#include "responder/common/responder.h"
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#include "providers/data_provider.h"
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder#include "responder/autofs/autofs_private.h"
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maederstatic int autofs_clean_hash_table(struct sbus_request *dbus_req, void *data);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillystruct mon_cli_iface monitor_autofs_methods = {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly { &mon_cli_iface_meta, 0 },
036ecbd8f721096321f47cf6a354a9d1bf3d032fChristian Maeder .resInit = monitor_common_res_init,
036ecbd8f721096321f47cf6a354a9d1bf3d032fChristian Maeder .shutDown = NULL,
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder .goOffline = NULL,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly .resetOffline = NULL,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly .rotateLogs = responder_logrotate,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly .clearMemcache = NULL,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly .clearEnumCache = autofs_clean_hash_table,
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly .sysbusReconnect = NULL,
caf021dd48c90ff6b26117f13e1d8c0ef1ca618aChristian Maeder};
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reillystatic errno_t
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reillyautofs_get_config(struct autofs_ctx *actx,
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly struct confdb_ctx *cdb)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly{
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly errno_t ret;
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly
caf021dd48c90ff6b26117f13e1d8c0ef1ca618aChristian Maeder ret = confdb_get_int(cdb, CONFDB_AUTOFS_CONF_ENTRY,
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly CONFDB_AUTOFS_MAP_NEG_TIMEOUT, 15,
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly &actx->neg_timeout);
caf021dd48c90ff6b26117f13e1d8c0ef1ca618aChristian Maeder return ret;
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly}
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maederstatic void
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maederautofs_dp_reconnect_init(struct sbus_connection *conn,
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder int status, void *pvt)
caf021dd48c90ff6b26117f13e1d8c0ef1ca618aChristian Maeder{
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn);
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly int ret;
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly /* Did we reconnect successfully? */
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder if (status == SBUS_RECONNECT_SUCCESS) {
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly DEBUG(SSSDBG_TRACE_FUNC, "Reconnected to the Data Provider.\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly /* Identify ourselves to the data provider */
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly ret = rdp_register_client(be_conn, "autofs");
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly /* all fine */
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly if (ret == EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly handle_requests_after_reconnect(be_conn->rctx);
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly return;
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly }
4770d29adda064baa5dbfcca03f600d7608806f7Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* Failed to reconnect */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n",
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly be_conn->domain->name);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly}
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillystatic int autofs_clean_hash_table(struct sbus_request *dbus_req, void *data)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly{
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct resp_ctx *rctx = talloc_get_type(data, struct resp_ctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct autofs_ctx *actx =
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder talloc_get_type(rctx->pvt_ctx, struct autofs_ctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly errno_t ret;
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder ret = autofs_orphan_maps(actx);
3c8d067accf18572352351ec42ff905c7297a8a5Christian Maeder if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_OP_FAILURE, "Could not invalidate maps\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return ret;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return sbus_request_return_and_finish(dbus_req, DBUS_TYPE_INVALID);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly}
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillystatic int
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillyautofs_process_init(TALLOC_CTX *mem_ctx,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct tevent_context *ev,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct confdb_ctx *cdb)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly{
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct resp_ctx *rctx;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct sss_cmd_table *autofs_cmds;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct autofs_ctx *autofs_ctx;
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder struct be_conn *iter;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly int ret;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly int hret;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly int max_retries;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly autofs_cmds = get_autofs_cmds();
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly ret = sss_process_init(mem_ctx, ev, cdb,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly autofs_cmds,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly SSS_AUTOFS_SOCKET_NAME, -1, NULL, -1,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly CONFDB_AUTOFS_CONF_ENTRY,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly SSS_AUTOFS_SBUS_SERVICE_NAME,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly SSS_AUTOFS_SBUS_SERVICE_VERSION,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly &monitor_autofs_methods,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly "autofs",
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly NULL,
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder autofs_connection_setup,
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly &rctx);
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly if (ret != EOK) {
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n");
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly return ret;
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly }
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder autofs_ctx = talloc_zero(rctx, struct autofs_ctx);
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder if (!autofs_ctx) {
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing autofs_ctx\n");
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder ret = ENOMEM;
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder goto fail;
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder }
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder ret = autofs_get_config(autofs_ctx, cdb);
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder if (ret != EOK) {
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder DEBUG(SSSDBG_FATAL_FAILURE, "Cannot read autofs configuration\n");
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder goto fail;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder autofs_ctx->rctx = rctx;
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder autofs_ctx->rctx->pvt_ctx = autofs_ctx;
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* Enable automatic reconnection to the Data Provider */
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder ret = confdb_get_int(autofs_ctx->rctx->cdb,
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder CONFDB_AUTOFS_CONF_ENTRY,
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder CONFDB_SERVICE_RECON_RETRIES,
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder 3, &max_retries);
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_FATAL_FAILURE,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly "Failed to set up automatic reconnection\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly goto fail;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly for (iter = autofs_ctx->rctx->be_conns; iter; iter = iter->next) {
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder sbus_reconnect_init(iter->conn, max_retries,
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder autofs_dp_reconnect_init, iter);
43e4005c54870e481df3a9be0f041caefe0c6eb5Christian Maeder }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* Create the lookup table for setautomntent results */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly hret = sss_hash_create_ex(autofs_ctx, 10, &autofs_ctx->maps, 0, 0, 0, 0,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly autofs_map_hash_delete_cb, NULL);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly if (hret != HASH_SUCCESS) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_CRIT_FAILURE,
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder "Unable to initialize automount maps hash table\n");
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder ret = EIO;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly goto fail;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly ret = schedule_get_domains_task(rctx, rctx->ev, rctx, NULL);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_FATAL_FAILURE, "schedule_get_domains_tasks failed.\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly goto fail;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG(SSSDBG_TRACE_FUNC, "autofs Initialization complete\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return EOK;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillyfail:
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly talloc_free(rctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return ret;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly}
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reillyint main(int argc, const char *argv[])
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder{
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly int opt;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly poptContext pc;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly struct main_context *main_ctx;
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder int ret;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly uid_t uid;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly gid_t gid;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder struct poptOption long_options[] = {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly POPT_AUTOHELP
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly SSSD_MAIN_OPTS
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly SSSD_SERVER_OPTS(uid, gid)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly POPT_TABLEEND
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly };
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* Set debug level to invalid value so we can decide if -d 0 was used. */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly debug_level = SSSDBG_INVALID;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly umask(DFL_RSP_UMASK);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly pc = poptGetContext(argv[0], argc, argv, long_options, 0);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly while((opt = poptGetNextOpt(pc)) != -1) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly switch(opt) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly default:
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly fprintf(stderr, "\nInvalid option %s: %s\n\n",
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly poptBadOption(pc, 0), poptStrerror(opt));
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly poptPrintUsage(pc, stderr, 0);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return 1;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly poptFreeContext(pc);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly DEBUG_INIT(debug_level);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* set up things like debug, signals, daemonization, etc... */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly debug_log_file = "sssd_autofs";
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly ret = server_setup("sssd[autofs]", 0, uid, gid,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly CONFDB_AUTOFS_CONF_ENTRY, &main_ctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return 2;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly ret = die_if_parent_died();
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* This is not fatal, don't return */
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Could not set up to exit "
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly "when parent process does\n");
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly ret = autofs_process_init(main_ctx,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly main_ctx->event_ctx,
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly main_ctx->confdb_ctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly if (ret != EOK) {
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return 3;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly }
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly /* loop on main */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly server_loop(main_ctx);
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly return 0;
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly}
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly