From 4dc031d50aab540e4834128ea16ff977c247be3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Mon, 31 Oct 2011 18:02:27 +0100 Subject: [PATCH 7/8] SUDO integration - SUDO LDAP provider --- Makefile.am | 1 + src/providers/ldap/ldap_common.h | 3 +++ src/providers/ldap/ldap_init.c | 37 +++++++++++++++++++++++++++++++++++++ src/providers/ldap/sdap_sudo.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 src/providers/ldap/sdap_sudo.c diff --git a/Makefile.am b/Makefile.am index ee0b1d5..c1340e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -849,6 +849,7 @@ libsss_ldap_la_SOURCES = \ src/providers/ldap/ldap_auth.c \ src/providers/ldap/ldap_init.c \ src/providers/ldap/ldap_common.c \ + src/providers/ldap/sdap_sudo.c \ src/providers/ldap/sdap_async.c \ src/providers/ldap/sdap_async_users.c \ src/providers/ldap/sdap_async_groups.c \ diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index 2d4b175..7341dc8 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -82,6 +82,9 @@ void sdap_pam_chpass_handler(struct be_req *breq); /* access */ void sdap_pam_access_handler(struct be_req *breq); +/* sudo */ +void sdap_sudo_handler(struct be_req *breq); + void sdap_handler_done(struct be_req *req, int dp_err, diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c index c00c0a9..5febd70 100644 --- a/src/providers/ldap/ldap_init.c +++ b/src/providers/ldap/ldap_init.c @@ -54,6 +54,12 @@ struct bet_ops sdap_access_ops = { .finalize = sdap_shutdown }; +/* SUDO Handler */ +struct bet_ops sdap_sudo_ops = { + .handler = sdap_sudo_handler, + .finalize = sdap_shutdown +}; + /* Please use this only for short lists */ errno_t check_order_list_for_duplicates(char **list, size_t len, bool case_sensitive) @@ -386,6 +392,37 @@ done: return ret; } +int sssm_ldap_sudo_init(struct be_ctx *bectx, + struct bet_ops **ops, + void **pvt_data) +{ + /*void *data; + struct sdap_id_ctx *id_ctx; + struct sdap_auth_ctx *ctx; + int ret; + + ret = sssm_ldap_id_init(bectx, ops, &data); + if (ret == EOK) { + id_ctx = talloc_get_type(data, struct sdap_id_ctx); + + ctx = talloc(bectx, struct sdap_auth_ctx); + if (!ctx) return ENOMEM; + + ctx->be = bectx; + ctx->opts = id_ctx->opts; + ctx->service = id_ctx->service; + ctx->chpass_service = NULL; + + *ops = &sdap_auth_ops; + *pvt_data = ctx; + }*/ + + *ops = &sdap_sudo_ops; + *pvt_data = NULL; + + return EOK; +} + static void sdap_shutdown(struct be_req *req) { /* TODO: Clean up any internal data */ diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c new file mode 100644 index 0000000..3745d92 --- /dev/null +++ b/src/providers/ldap/sdap_sudo.c @@ -0,0 +1,28 @@ +/* + Authors: + Pavel Březina + + Copyright (C) 2011 Red Hat + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "providers/dp_backend.h" + +void sdap_sudo_handler(struct be_req *be_req) +{ + DEBUG(0, ("=== sdap_sudo_handler ===\n")); + + be_req->fn(be_req, 0, 0, NULL); +} -- 1.7.6.4