From c20937a81461f7a16e488ab89d0fecfb1052ebf9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Thu, 17 Feb 2011 13:42:16 +0000 Subject: [PATCH] Hide JDL fields --- org.glite.lb.server/src/authz_policy.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.server/src/authz_policy.c b/org.glite.lb.server/src/authz_policy.c index bbc5492..0300899 100644 --- a/org.glite.lb.server/src/authz_policy.c +++ b/org.glite.lb.server/src/authz_policy.c @@ -18,6 +18,8 @@ limitations under the License. #include #include +#include + #include #include "authz_policy.h" @@ -44,6 +46,12 @@ struct attr_id_name attr_id_names[] = { static int num_attrs = sizeof(attr_id_names) / sizeof(attr_id_names[0]); +const char *allowed_jdl_fields[] = { + "VirtualOrganisation", + "JobType", + "Type", +}; + static int check_rule(_edg_wll_authz_rule *rule, edg_wll_GssPrincipal principal) { @@ -153,8 +161,23 @@ blacken_fields(edg_wll_JobStat *stat, int flags) if (flags & STATUS_FOR_MONITORING) { new_stat.state = stat->state; edg_wlc_JobIdDup(stat->jobId, &new_stat.jobId); - if (stat->jdl) - new_stat.jdl = strdup(stat->jdl); + if (stat->jdl) { + struct cclassad *ad, *new_ad; + char *str; + int i; + + ad = cclassad_create(stat->jdl); + if (ad) { + new_ad = cclassad_create(NULL); + for (i = 0; i < sizeof(allowed_jdl_fields)/sizeof(allowed_jdl_fields[0]);i++) + if (cclassad_evaluate_to_string(ad, allowed_jdl_fields[i], &str)) + cclassad_insert_string(new_ad, allowed_jdl_fields[i], str); + new_stat.jdl = cclassad_unparse(new_ad); + cclassad_delete(ad); + cclassad_delete(new_ad); + } + } + new_stat.jobtype = stat->jobtype; if (stat->destination) new_stat.destination = strdup(stat->destination); if (stat->network_server) -- 1.8.2.3