b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose PAC Responder
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose Copyright (C) Sumit Bose <sbose@redhat.com> 2011
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose This program is free software; you can redistribute it and/or modify
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose it under the terms of the GNU General Public License as published by
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose the Free Software Foundation; either version 3 of the License, or
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose (at your option) any later version.
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose This program is distributed in the hope that it will be useful,
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose GNU General Public License for more details.
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose You should have received a copy of the GNU General Public License
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose/* TODO: check if this can be made generic for all responders */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bosestatic void pac_dp_reconnect_init(struct sbus_connection *conn,
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose struct be_conn *be_conn = talloc_get_type(pvt, struct be_conn);
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* Did we reconnect successfully? */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_OP_FAILURE, "Reconnected to the Data Provider.\n");
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* Identify ourselves to the data provider */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* all fine */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* Failed to reconnect */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n",
677a31351c80453d9ce006481364399a96312052René Genz /* FIXME: kill the frontend and let the monitor restart it? */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* nss_shutdown(rctx); */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "sss_process_init() failed\n");
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "fatal error initializing pac_ctx\n");
2d257ccf620ce1b611f89cec8f0a94c88c2f2881Sumit Bose ret = confdb_get_string(pac_ctx->rctx->cdb, pac_ctx->rctx,
2d257ccf620ce1b611f89cec8f0a94c88c2f2881Sumit Bose CONFDB_PAC_CONF_ENTRY, CONFDB_SERVICE_ALLOWED_UIDS,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Failed to get allowed UIDs.\n");
2d257ccf620ce1b611f89cec8f0a94c88c2f2881Sumit Bose ret = csv_string_to_uid_array(pac_ctx->rctx, uid_str, true,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Failed to set allowed UIDs.\n");
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* Enable automatic reconnection to the Data Provider */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "Failed to set up automatic reconnection\n");
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose for (iter = pac_ctx->rctx->be_conns; iter; iter = iter->next) {
a473fb88e6015cf0ccbd2e9005c7e6acca18f452Pavel Březina err = sss_idmap_init(sss_idmap_talloc, pac_ctx, sss_idmap_talloc_free,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_FATAL_FAILURE, "sss_idmap_init failed.\n");
f1a7e4a6e4f2d453077da8b3606feebb7669ef4fSumit Bose /* Set up file descriptor limits */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov "Failed to set up file descriptor limit\n");
d0d7de66c9494621c1bc12384e41e5e38a77fbebSumit Bose ret = confdb_get_int(pac_ctx->rctx->cdb, CONFDB_PAC_CONF_ENTRY,
d0d7de66c9494621c1bc12384e41e5e38a77fbebSumit Bose "Failed to setup negative cache timeout.\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, "PAC Initialization complete\n");
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* Set debug level to invalid value so we can decide if -d 0 was used. */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose pc = poptGetContext(argv[0], argc, argv, long_options, 0);
677a31351c80453d9ce006481364399a96312052René Genz /* set up things like debug, signals, daemonization, etc. */
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* This is not fatal, don't return */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_OP_FAILURE, "Could not set up to exit when parent process does\n");
b9e5bd09a5ff7009537a18914dbebcf10498f592Sumit Bose /* loop on main */