bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose/*
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose SSSD
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose AD SUDO Provider Initialization functions
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose Authors:
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose Sumit Bose <sbose@redhat.com>
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose Copyright (C) 2014 Red Hat
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose This program is free software; you can redistribute it and/or modify
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose it under the terms of the GNU General Public License as published by
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose the Free Software Foundation; either version 3 of the License, or
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose (at your option) any later version.
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose This program is distributed in the hope that it will be useful,
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose GNU General Public License for more details.
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose You should have received a copy of the GNU General Public License
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose*/
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose#include "providers/ad/ad_common.h"
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose#include "providers/ldap/sdap_sudo.h"
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Boseerrno_t ad_sudo_init(TALLOC_CTX *mem_ctx,
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose struct be_ctx *be_ctx,
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose struct ad_id_ctx *id_ctx,
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose struct dp_method *dp_methods)
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose{
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose errno_t ret;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose struct ad_options *ad_options;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose struct sdap_options *ldap_options;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose DEBUG(SSSDBG_TRACE_INTERNAL, "Initializing sudo AD back end\n");
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose ret = sdap_sudo_init(mem_ctx, be_ctx, id_ctx->sdap_id_ctx, dp_methods);
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose if (ret != EOK) {
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose DEBUG(SSSDBG_OP_FAILURE, "Cannot initialize LDAP SUDO [%d]: %s\n",
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose ret, sss_strerror(ret));
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose return ret;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose }
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose ad_options = id_ctx->ad_options;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose ldap_options = id_ctx->sdap_id_ctx->opts;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose ad_options->id->sudorule_map = ldap_options->sudorule_map;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose return EOK;
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose}
bf6c3f07d653d474da9e43b2b7cced57fc4ea069Sumit Bose