From 0cdb1bba32c174a395da2aad047698590633cf3c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sun, 8 Mar 2015 21:36:20 +0100 Subject: [PATCH] bug #3659: Advance GROUP_ADMIN comparison --- src/rm/RequestManagerAllocate.cc | 20 ++++++++------------ src/rm/RequestManagerUpdateTemplate.cc | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/rm/RequestManagerAllocate.cc b/src/rm/RequestManagerAllocate.cc index 4830f8f2e3..6e6fd3af84 100644 --- a/src/rm/RequestManagerAllocate.cc +++ b/src/rm/RequestManagerAllocate.cc @@ -530,7 +530,7 @@ bool TemplateAllocate::allocate_authorization( RequestAttributes& att, PoolObjectAuth * cluster_perms) { - if ( att.uid == UserPool::ONEADMIN_ID ) + if ( att.uid == UserPool::ONEADMIN_ID || att.gid == GroupPool::ONEADMIN_ID ) { return true; } @@ -542,21 +542,17 @@ bool TemplateAllocate::allocate_authorization( VirtualMachineTemplate * ttmpl = static_cast(tmpl); // ------------ Check template for restricted attributes ------------------- - - if ( att.uid != UserPool::ONEADMIN_ID && att.gid != GroupPool::ONEADMIN_ID ) + if (ttmpl->check(aname)) { - if (ttmpl->check(aname)) - { - ostringstream oss; + ostringstream oss; - oss << "VM Template includes a restricted attribute " << aname; + oss << "VM Template includes a restricted attribute " << aname; - failure_response(AUTHORIZATION, - authorization_error(oss.str(), att), - att); + failure_response(AUTHORIZATION, + authorization_error(oss.str(), att), + att); - return false; - } + return false; } return true; diff --git a/src/rm/RequestManagerUpdateTemplate.cc b/src/rm/RequestManagerUpdateTemplate.cc index a4a6a0f67d..7e6c4eb9aa 100644 --- a/src/rm/RequestManagerUpdateTemplate.cc +++ b/src/rm/RequestManagerUpdateTemplate.cc @@ -95,8 +95,8 @@ void RequestManagerUpdateTemplate::request_execute( object = pool->get(oid,true); - if ( object == 0 ) - { + if ( object == 0 ) + { failure_response(NO_EXISTS, get_error(object_name(auth_object),oid), att);