ldap_id_enum.c revision c9eaf8c1e02c155b7ca7ffb2b1edade8a23ce1ff
842ae4bd224140319ae7feec1872b93dfd491143fielding LDAP Identity Enumeration
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding Simo Sorce <ssorce@redhat.com>
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding Copyright (C) 2009 Red Hat
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd This program is free software; you can redistribute it and/or modify
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd it under the terms of the GNU General Public License as published by
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd the Free Software Foundation; either version 3 of the License, or
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd (at your option) any later version.
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding This program is distributed in the hope that it will be useful,
2d71630471d1c23f0137309e3c3957c633ecbfd6rbb but WITHOUT ANY WARRANTY; without even the implied warranty of
8f3ec4772d2aeb347cf40e87c77627bb784dd018rbb MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c6e3de48da56d5a2d6298585b895cf75e3ffada2ben GNU General Public License for more details.
c6e3de48da56d5a2d6298585b895cf75e3ffada2ben You should have received a copy of the GNU General Public License
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe along with this program. If not, see <http://www.gnu.org/licenses/>.
6e8fa9b44c6d5f5b3ac9dab52c4734259bcd8335coar ret = sysdb_has_enumerated(sdom->dom, &has_enumerated);
e4afb803ff9a51f9ec7969f232b7fd4a4e94d5d4rbb /* default value */
c6e3de48da56d5a2d6298585b895cf75e3ffada2ben /* At least one enumeration has previously run,
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * so clients will get cached data. We will delay
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * starting to enumerate by 10s so we don't slow
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * down the startup process if this is happening
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * during system boot.
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe /* This is our first startup. Schedule the
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * enumeration to start immediately once we
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe * enter the mainloop.
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe period = dp_opt_get_int(opts->basic, SDAP_ENUM_REFRESH_TIMEOUT);
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe 0, /* random offset */
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe 0, /* max_backoff */
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe "Unable to initialize enumeration periodic task\n");
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowestatic void ldap_enumeration_done(struct tevent_req *subreq);
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe DEBUG(SSSDBG_CRIT_FAILURE, "Cannot retrieve ldap_enum_ctx!\n");
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe state->id_ctx = talloc_get_type_abort(ectx->pvt, struct sdap_id_ctx);
6e8fa9b44c6d5f5b3ac9dab52c4734259bcd8335coar subreq = sdap_dom_enum_send(ectx, ev, state->id_ctx, ectx->sdom,
6e8fa9b44c6d5f5b3ac9dab52c4734259bcd8335coar /* The ptask API will reschedule the enumeration on its own on
6e8fa9b44c6d5f5b3ac9dab52c4734259bcd8335coar * failure */
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe "Failed to schedule enumeration, retrying later!\n");
e46d12b7a404d93e9ed9d09299e98b9431d95800wrowe tevent_req_set_callback(subreq, ldap_enumeration_done, req);