2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina Pavel Březina <pbrezina@redhat.com>
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina Copyright (C) 2011 Red Hat
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina This program is free software; you can redistribute it and/or modify
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina it under the terms of the GNU General Public License as published by
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina the Free Software Foundation; either version 3 of the License, or
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina (at your option) any later version.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina This program is distributed in the hope that it will be useful,
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina GNU General Public License for more details.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina You should have received a copy of the GNU General Public License
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březinastatic void sudo_dp_reconnect_init(struct sbus_connection *conn,
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn);
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* Did we reconnect successfully? */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_TRACE_FUNC, "Reconnected to the Data Provider.\n");
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* Identify ourselves to the data provider */
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* all fine */
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* Failed to reconnect */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n",
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n");
7c9fe57ad82747a32721ca0a08c5569282f3e0c4Pavel Březina sudo_ctx = talloc_zero(rctx, struct sudo_ctx);
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing sudo_ctx\n");
e3bb7b3fda4697fa9c6f80107cd01dd04a20c85fPetr Cech sss_ncache_prepopulate(sudo_ctx->rctx->ncache, sudo_ctx->rctx->cdb, rctx);
2a25713afc6beefb11a799903a43f695c5d7a4f9Adam Tkac "failed to set ncache for sudo's filter_users\n");
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* Enable automatic reconnection to the Data Provider */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov "Failed to set up automatic reconnection\n");
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina for (iter = sudo_ctx->rctx->be_conns; iter; iter = iter->next) {
c9aab1c04c399ca2d1abef74f6df22ced34983dcPavel Březina /* Get sudo_timed option */
52e3ee5c5ff2c5a4341041826a803ad42d2b2de7Pavel Březina DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n",
52e3ee5c5ff2c5a4341041826a803ad42d2b2de7Pavel Březina /* Get sudo_inverse_order option */
52e3ee5c5ff2c5a4341041826a803ad42d2b2de7Pavel Březina CONFDB_SUDO_CONF_ENTRY, CONFDB_SUDO_INVERSE_ORDER,
a5f300adf19ec9c3087c62bd93a5175db799687aPavel Březina DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n",
a5f300adf19ec9c3087c62bd93a5175db799687aPavel Březina /* Get sudo_inverse_order option */
a5f300adf19ec9c3087c62bd93a5175db799687aPavel Březina CONFDB_SUDO_CONF_ENTRY, CONFDB_SUDO_THRESHOLD,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n",
0528fdec17d0031996e919fcd852459e86592c35Jakub Hrozek ret = schedule_get_domains_task(rctx, rctx->ev, rctx, NULL);
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "schedule_get_domains_tasks failed.\n");
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_TRACE_FUNC, "SUDO Initialization complete\n");
677a31351c80453d9ce006481364399a96312052René Genz /* Set debug level to invalid value so we can decide if -d 0 was used. */
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina pc = poptGetContext(argv[0], argc, argv, long_options, 0);
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina fprintf(stderr, "\nInvalid option %s: %s\n\n",
677a31351c80453d9ce006481364399a96312052René Genz /* set up things like debug, signals, daemonization, etc. */
3f9e2c24dbc14b2eafbe4f5a5ee16fe9af3c3f75Jakub Hrozek ret = server_setup("sssd[sudo]", 0, uid, gid, CONFDB_SUDO_CONF_ENTRY,
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* 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");
2827b0d03f7b6bafa504d22a5d7ca39cbda048b3Pavel Březina /* loop on main */