From 5bd29f76a8aee228b3ce07e2ec6453f7374a4acc Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 26 Jul 2016 12:13:43 +0200 Subject: [PATCH 3/4] SIMPLE: Make the DP handlers testable To make it possible to call the whole DP handler in the unit test, not just the evaluator part. --- Makefile.am | 1 + src/providers/simple/simple_access.c | 5 ++-- src/providers/simple/simple_access_pvt.h | 43 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/providers/simple/simple_access_pvt.h diff --git a/Makefile.am b/Makefile.am index 3d84bd868a8d0b8f9df329aa8978c215ba750a45..5d1d671096f986d9387e6199112c017e9bf30e1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -665,6 +665,7 @@ dist_noinst_HEADERS = \ src/providers/fail_over_srv.h \ src/util/child_common.h \ src/providers/simple/simple_access.h \ + src/providers/simple/simple_access_pvt.h \ src/providers/krb5/krb5_auth.h \ src/providers/krb5/krb5_common.h \ src/providers/krb5/krb5_utils.h \ diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c index 577e8354e9b574764734248b2bde4ef06c6fb4fc..521beee84833b47b547bd1045c24e3384aa4d9a5 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -22,6 +22,7 @@ #include #include "providers/simple/simple_access.h" +#include "providers/simple/simple_access_pvt.h" #include "util/sss_utf8.h" #include "providers/backend.h" #include "db/sysdb.h" @@ -176,7 +177,7 @@ struct simple_access_handler_state { static void simple_access_handler_done(struct tevent_req *subreq); -static struct tevent_req * +struct tevent_req * simple_access_handler_send(TALLOC_CTX *mem_ctx, struct simple_ctx *simple_ctx, struct pam_data *pd, @@ -265,7 +266,7 @@ done: tevent_req_done(req); } -static errno_t +errno_t simple_access_handler_recv(TALLOC_CTX *mem_ctx, struct tevent_req *req, struct pam_data **_data) diff --git a/src/providers/simple/simple_access_pvt.h b/src/providers/simple/simple_access_pvt.h new file mode 100644 index 0000000000000000000000000000000000000000..c133e1c5531be35861178e0b23aa7a09db9f7703 --- /dev/null +++ b/src/providers/simple/simple_access_pvt.h @@ -0,0 +1,43 @@ +/* + SSSD + + Simple access control + + Copyright (C) Sumit Bose 2010 + + 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 . +*/ + +#ifndef __SIMPLE_ACCESS_PVT_H__ +#define __SIMPLE_ACCESS_PVT_H__ + +#include "providers/data_provider/dp.h" + +/* We only 'export' the functions in a private header file to be able to call + * them from unit tests + */ +struct tevent_req * +simple_access_handler_send(TALLOC_CTX *mem_ctx, + struct simple_ctx *simple_ctx, + struct pam_data *pd, + struct dp_req_params *params); + +errno_t +simple_access_handler_recv(TALLOC_CTX *mem_ctx, + struct tevent_req *req, + struct pam_data **_data); + +int simple_access_obtain_filter_lists(struct simple_ctx *ctx); + +#endif /* __SIMPLE_ACCESS_PVT_H__ */ -- 2.4.11