Change-Id: I45c4872f34ff8f25c14872d7b3610fa15f48062e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
#include "afb-cred.h"
#include "verbose.h"
#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) {
int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth)
{
switch (auth->type) {
case afb_auth_Permission:
if (xreq->cred && auth->text)
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;
/* TODO: handle case of self permission */
return 1;
static cynara *handle;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
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)
/*********************************************************************************/
#else
/*********************************************************************************/
#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;
{
WARNING("Granting permission %s by default of backend", permission);
return 1;
struct afb_xreq;
extern int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth);
struct afb_xreq;
extern int afb_auth_check(struct afb_xreq *xreq, const struct afb_auth *auth);
+extern int afb_auth_check_permission(struct afb_xreq *xreq, const char *permission);
+