7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina Pavel Březina <pbrezina@redhat.com>
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina Copyright (C) 2013 Red Hat
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina This program is free software; you can redistribute it and/or modify
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina it under the terms of the GNU General Public License as published by
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina the Free Software Foundation; either version 3 of the License, or
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina (at your option) any later version.
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina This program is distributed in the hope that it will be useful,
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina GNU General Public License for more details.
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina You should have received a copy of the GNU General Public License
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic errno_t sdap_refresh_step(struct tevent_req *req);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic void sdap_refresh_done(struct tevent_req *subreq);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic struct tevent_req *sdap_refresh_send(TALLOC_CTX *mem_ctx,
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina state->id_ctx = talloc_get_type(pvt, struct sdap_id_ctx);
b0d3164ca2bd842e176268c26935c5ce54f7f76ePavel Březina state->sdom = sdap_domain_get(state->id_ctx->opts, domain);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Invalid entry type [%d]!\n", entry_type);
3d29430867cf92b2d71afa95abb679711231117cPavel Březina state->account_req = talloc_zero(state, struct dp_id_data);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina state->account_req->filter_type = BE_FILTER_NAME;
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina /* filter will be filled later */
a3c8390d19593b1e5277d95bfb4ab206d4785150Nikolai Kondrashov DEBUG(SSSDBG_TRACE_FUNC, "Nothing to refresh\n");
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "sdap_refresh_step() failed "
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic errno_t sdap_refresh_step(struct tevent_req *req)
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina state = tevent_req_data(req, struct sdap_refresh_state);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina state->account_req->filter_value = state->names[state->index];
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina if (state->account_req->filter_value == NULL) {
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina DEBUG(SSSDBG_TRACE_FUNC, "Issuing refresh of %s %s\n",
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina state->type, state->account_req->filter_value);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina subreq = sdap_handle_acct_req_send(state, state->be_ctx,
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina tevent_req_set_callback(subreq, sdap_refresh_done, req);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic void sdap_refresh_done(struct tevent_req *subreq)
7b5e7e539ae9312ab55d75aa94feaad549b2a708Pavel Březina req = tevent_req_callback_data(subreq, struct tevent_req);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina state = tevent_req_data(req, struct sdap_refresh_state);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina ret = sdap_handle_acct_req_recv(subreq, &dp_error, &err_msg, &sdap_ret);
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to refresh %s [dp_error: %d, "
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina "sdap_ret: %d, errno: %d]: %s\n", state->type,
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březinastatic errno_t sdap_refresh_recv(struct tevent_req *req)
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březinastatic struct tevent_req *
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březina return sdap_refresh_send(mem_ctx, ev, be_ctx, domain,
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březinastatic errno_t sdap_refresh_users_recv(struct tevent_req *req)
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březinastatic struct tevent_req *
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březina return sdap_refresh_send(mem_ctx, ev, be_ctx, domain,
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březinastatic errno_t sdap_refresh_groups_recv(struct tevent_req *req)
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březinastatic struct tevent_req *
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březinasdap_refresh_netgroups_send(TALLOC_CTX *mem_ctx,
ab0eda3622b828df2bfb7850c96d1395f614eb13Pavel Březina return sdap_refresh_send(mem_ctx, ev, be_ctx, domain,
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březinastatic errno_t sdap_refresh_netgroups_recv(struct tevent_req *req)
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březinaerrno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březina ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_USERS,
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březina DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh of users "
e77d6366ff9e49dbbb607f1709f1ae4190b99489Pavel Březina "will not work [%d]: %s\n", ret, strerror(ret));
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březina ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_GROUPS,
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březina DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh of groups "
61c8d13e55ebafc28da1b0b5ad9ae578d687e288Pavel Březina "will not work [%d]: %s\n", ret, strerror(ret));
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březina ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_NETGROUPS,
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březina DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh of netgroups "
17531a398cc9084036cb08d69fe876a8f12707bbPavel Březina "will not work [%d]: %s\n", ret, strerror(ret));