619bd403265ce0880989ba6f8324b010949851bcSumit Bose LDAP Identity Backend Module - Netgroup support
619bd403265ce0880989ba6f8324b010949851bcSumit Bose Sumit Bose <sbose@redhat.com>
619bd403265ce0880989ba6f8324b010949851bcSumit Bose Copyright (C) 2010 Red Hat
619bd403265ce0880989ba6f8324b010949851bcSumit Bose This program is free software; you can redistribute it and/or modify
619bd403265ce0880989ba6f8324b010949851bcSumit Bose it under the terms of the GNU General Public License as published by
619bd403265ce0880989ba6f8324b010949851bcSumit Bose the Free Software Foundation; either version 3 of the License, or
619bd403265ce0880989ba6f8324b010949851bcSumit Bose (at your option) any later version.
619bd403265ce0880989ba6f8324b010949851bcSumit Bose This program is distributed in the hope that it will be useful,
619bd403265ce0880989ba6f8324b010949851bcSumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
619bd403265ce0880989ba6f8324b010949851bcSumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
619bd403265ce0880989ba6f8324b010949851bcSumit Bose GNU General Public License for more details.
619bd403265ce0880989ba6f8324b010949851bcSumit Bose You should have received a copy of the GNU General Public License
619bd403265ce0880989ba6f8324b010949851bcSumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic int ldap_netgroup_get_retry(struct tevent_req *req);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic void ldap_netgroup_get_connect_done(struct tevent_req *subreq);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic void ldap_netgroup_get_done(struct tevent_req *subreq);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystruct tevent_req *ldap_netgroup_get_send(TALLOC_CTX *memctx,
ca344fdecdf127c80ad1074047aeba21e1165313Jakub Hrozek const char *name,
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny req = tevent_req_create(memctx, &state, struct ldap_netgroup_get_state);
9aa117a93e315f790a1922d9ac7bd484878b621eJakub Hrozek state->op = sdap_id_op_create(state, state->conn->conn_cache);
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov DEBUG(SSSDBG_OP_FAILURE, "sdap_id_op_create failed\n");
a530a96721d8106a6839b6b643b0abc5d7a7b9e0Sumit Bose state->timeout = dp_opt_get_int(ctx->opts->basic, SDAP_SEARCH_TIMEOUT);
85e8cbdd79359ae1f330c8b84f7b58d4fc6fda6eStephen Gallagher ret = sss_filter_sanitize(state, name, &clean_name);
619bd403265ce0880989ba6f8324b010949851bcSumit Bose state->filter = talloc_asprintf(state, "(&(%s=%s)(objectclass=%s))",
619bd403265ce0880989ba6f8324b010949851bcSumit Bose ctx->opts->netgroup_map[SDAP_AT_NETGROUP_NAME].name,
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov DEBUG(SSSDBG_OP_FAILURE, "Failed to build filter\n");
64ddff90c7fcc02ccb06824ac93af7d5f361a88fJan Zeleny ret = build_attrs_from_map(state, ctx->opts->netgroup_map, SDAP_OPTS_NETGROUP,
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic int ldap_netgroup_get_retry(struct tevent_req *req)
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny struct ldap_netgroup_get_state *state = tevent_req_data(req,
619bd403265ce0880989ba6f8324b010949851bcSumit Bose subreq = sdap_id_op_connect_send(state->op, state, &ret);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny tevent_req_set_callback(subreq, ldap_netgroup_get_connect_done, req);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic void ldap_netgroup_get_connect_done(struct tevent_req *subreq)
619bd403265ce0880989ba6f8324b010949851bcSumit Bose struct tevent_req *req = tevent_req_callback_data(subreq,
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny struct ldap_netgroup_get_state *state = tevent_req_data(req,
619bd403265ce0880989ba6f8324b010949851bcSumit Bose ret = sdap_id_op_connect_recv(subreq, &dp_error);
619bd403265ce0880989ba6f8324b010949851bcSumit Bose subreq = sdap_get_netgroups_send(state, state->ev,
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny tevent_req_set_callback(subreq, ldap_netgroup_get_done, req);
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zelenystatic void ldap_netgroup_get_done(struct tevent_req *subreq)
619bd403265ce0880989ba6f8324b010949851bcSumit Bose struct tevent_req *req = tevent_req_callback_data(subreq,
7d9f54f5ec7c72336c4f69dbf20d55f1f64b88d2Jan Zeleny struct ldap_netgroup_get_state *state = tevent_req_data(req,
619bd403265ce0880989ba6f8324b010949851bcSumit Bose ret = sdap_get_netgroups_recv(subreq, state, NULL, &state->count,
619bd403265ce0880989ba6f8324b010949851bcSumit Bose ret = sdap_id_op_done(state->op, ret, &dp_error);
83bf46f4066e3d5e838a32357c201de9bd6ecdfdNikolai Kondrashov "Found more than one netgroup with the name [%s].\n",
ca344fdecdf127c80ad1074047aeba21e1165313Jakub Hrozek if (ret == ENOENT && state->noexist_delete == true) {
d115f40c7a3999e3cbe705a2ff9cf0fd493f80fbMichal Zidek ret = sysdb_delete_netgroup(state->domain, state->name);
ca344fdecdf127c80ad1074047aeba21e1165313Jakub Hrozekint ldap_netgroup_get_recv(struct tevent_req *req, int *dp_error_out, int *sdap_ret)