From a9f8cf6c564a5aeb39c60cff4a91239141a2e3e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Wed, 16 May 2012 12:43:32 +0000 Subject: [PATCH] Convenience function to check current user's (ctx) authorization for actions. --- org.glite.lb.server/src/authz_policy.c | 13 +++++++++++++ org.glite.lb.server/src/authz_policy.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/org.glite.lb.server/src/authz_policy.c b/org.glite.lb.server/src/authz_policy.c index 0c213e0..2d03e88 100644 --- a/org.glite.lb.server/src/authz_policy.c +++ b/org.glite.lb.server/src/authz_policy.c @@ -123,6 +123,19 @@ check_authz_policy(edg_wll_authz_policy policy, return 0; } +int +check_authz_policy_ctx(edg_wll_Context ctx, + authz_action action) +{ + struct _edg_wll_GssPrincipal_data princ; + memset(&princ, 0, sizeof princ); + + princ.name = ctx->peerName; + princ.fqans = ctx->fqans; + + return check_authz_policy(&ctx->authz_policy, &princ, action); +} + authz_action find_authz_action(const char *name) { diff --git a/org.glite.lb.server/src/authz_policy.h b/org.glite.lb.server/src/authz_policy.h index b6f73b9..a37d87a 100644 --- a/org.glite.lb.server/src/authz_policy.h +++ b/org.glite.lb.server/src/authz_policy.h @@ -59,6 +59,9 @@ parse_server_policy(edg_wll_Context ctx, const char *filename, edg_wll_authz_pol int check_authz_policy(edg_wll_authz_policy, edg_wll_GssPrincipal, authz_action); +int +check_authz_policy_ctx(edg_wll_Context ctx, authz_action); + authz_action find_authz_action(const char *name); -- 1.8.2.3