static int wait_for_open(edg_wll_Context,const char *);
static int decrement_timeout(struct timeval *, struct timeval, struct timeval);
static int asyn_gethostbyaddr(char **, char **, const struct sockaddr *, int, struct timeval *, int );
-static int add_root(edg_wll_Context, char *);
+static int add_root(edg_wll_Context, char *, authz_action);
static int parse_limits(char *, int *, int *, int *);
static int check_mkdir(const char *);
case 'X': notif_ilog_socket_path = strdup(optarg); break;
case 'Y': notif_ilog_file_prefix = strdup(optarg); break;
case 'i': strcpy(pidfile,optarg); pidfile_forced = 1; break;
- case 'R': add_root(ctx, optarg); break;
+ case 'R': add_root(ctx, optarg, ADMIN_ACCESS); break;
case 'F': glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_FATAL,
"%s: Option --super-users-file is deprecated, specify policy using --policy instead");
return 1;
{
glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Server identity: %s", mycred->name);
server_subject = strdup(mycred->name);
- add_root(ctx, server_subject);
+ add_root(ctx, server_subject, READ_ALL);
+ add_root(ctx, server_subject, PURGE);
}
else {
glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "Server running unauthenticated");
return err;
}
-static int add_root(edg_wll_Context ctx, char *root)
+static int add_root(edg_wll_Context ctx, char *root, authz_action action)
{
struct _edg_wll_authz_attr attr;
struct _edg_wll_authz_rule rule;
- attr.value = root;
attr.id = ATTR_SUBJECT;
if (strncmp(root, "FQAN:", 5) == 0){
root += 5;
attr.id = ATTR_FQAN;
}
+ attr.value = root;
rule.attrs = &attr;
rule.attrs_num = 1;
- edg_wll_add_authz_rule(ctx, &authz_policy, ADMIN_ACCESS, &rule);
+ edg_wll_add_authz_rule(ctx, &authz_policy, action, &rule);
return 0;
}
#include "db_supp.h"
#include "jobstat.h"
#include "il_notification.h"
+#include "authz_policy.h"
#define DUMP_FILE_STORAGE "/tmp/"
struct timeval tp;
edg_wll_JobStat stat;
purge_ctx_t prg;
+ struct _edg_wll_GssPrincipal_data princ;
+ princ.name = ctx->peerName;
+ princ.fqans = ctx->fqans;
- if (!ctx->noAuth) {
+ if (!ctx->noAuth && !check_authz_policy(&ctx->authz_policy, &princ, PURGE)) {
edg_wll_SetError(ctx,EPERM,"only superusers may purge");
goto abort;
}
#include "glite/jobid/strmd5.h"
#include "stats.h"
+#include "authz_policy.h"
static int stats_inc_counter(edg_wll_Context,const edg_wll_JobStat *,edg_wll_Stats *);
static int stats_record_duration(edg_wll_Context,const edg_wll_JobStat *,const edg_wll_JobStat *,edg_wll_Stats *);
char *sig = NULL;
time_t afrom,ato;
long match;
+ struct _edg_wll_GssPrincipal_data princ;
+
+ princ.name = ctx->peerName;
+ princ.fqans = ctx->fqans;
edg_wll_ResetError(ctx);
switch (ctx->count_statistics) {
case 0: return edg_wll_SetError(ctx,ENOSYS,NULL);
- case 1: if (!ctx->noAuth) return edg_wll_SetError(ctx,EPERM,NULL);
+ case 1: if (!ctx->noAuth && !check_authz_policy(&ctx->authz_policy, &princ, GET_STATISTICS)) return edg_wll_SetError(ctx,EPERM,NULL);
break;
case 2: break;
default: abort();