aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-auth.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-04 10:30:26 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-09-07 09:43:13 +0200
commit2f0f452807a35a01d879659adb217e1d9234585d (patch)
tree3881e402e7a5e15b31b49b5d5967224599b1e50e /src/afb-auth.c
parent718de20a3cf830ba2da0a6c37e4588e4df251f1d (diff)
afb-auth: export method to check a single permission
Change-Id: I45c4872f34ff8f25c14872d7b3610fa15f48062e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-auth.c')
-rw-r--r--src/afb-auth.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/afb-auth.c b/src/afb-auth.c
index 5c62f9f7..17d355b0 100644
--- a/src/afb-auth.c
+++ b/src/afb-auth.c
@@ -29,8 +29,6 @@
#include "afb-cred.h"
#include "verbose.h"
-static int check_permission(struct afb_xreq *xreq, const char *permission);
-
int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth)
{
switch (auth->type) {
@@ -46,7 +44,7 @@ int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth)
case afb_auth_Permission:
if (xreq->cred && auth->text)
- return check_permission(xreq, auth->text);
+ return afb_auth_check_permission(xreq, auth->text);
/* TODO: handle case of self permission */
return 1;
@@ -73,7 +71,7 @@ int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth)
static cynara *handle;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static int check_permission(struct afb_xreq *xreq, const char *permission)
+int afb_auth_check_permission(struct afb_xreq *xreq, const char *permission)
{
int rc;
@@ -99,7 +97,7 @@ static int check_permission(struct afb_xreq *xreq, const char *permission)
/*********************************************************************************/
#else
-static int check_permission(struct afb_xreq *xreq, const char *permission)
+int afb_auth_check_permission(struct afb_xreq *xreq, const char *permission)
{
WARNING("Granting permission %s by default of backend", permission);
return 1;