diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2016-07-26 12:13:43 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-08-10 16:55:53 +0200 |
commit | c777f575b0ec0c48ce3b85ea2c5cc298db02450e (patch) | |
tree | 8c89068daed26ab8fd20237d122d7d2a839b1ba6 | |
parent | 79ac0e8a4840202c3615d6ce6584df3c08efb594 (diff) | |
download | sssd-c777f575b0ec0c48ce3b85ea2c5cc298db02450e.tar.gz sssd-c777f575b0ec0c48ce3b85ea2c5cc298db02450e.tar.xz sssd-c777f575b0ec0c48ce3b85ea2c5cc298db02450e.zip |
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.
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/providers/simple/simple_access.c | 5 | ||||
-rw-r--r-- | src/providers/simple/simple_access_pvt.h | 43 |
3 files changed, 47 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 3d84bd868..5d1d67109 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 577e8354e..521beee84 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -22,6 +22,7 @@ #include <security/pam_modules.h> #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 000000000..c133e1c55 --- /dev/null +++ b/src/providers/simple/simple_access_pvt.h @@ -0,0 +1,43 @@ +/* + SSSD + + Simple access control + + Copyright (C) Sumit Bose <sbose@redhat.com> 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 <http://www.gnu.org/licenses/>. +*/ + +#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__ */ |