From d88fc7fc9b22a7638c67857fcc53f10585d78d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 11 Jan 2012 06:41:58 -0800 Subject: [PATCH 1/2] Add ORDER BY sorting in pool dumps --- src/pool/PoolSQL.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pool/PoolSQL.cc b/src/pool/PoolSQL.cc index 33e630a53a..da12a53ed9 100644 --- a/src/pool/PoolSQL.cc +++ b/src/pool/PoolSQL.cc @@ -443,6 +443,8 @@ int PoolSQL::dump(ostringstream& oss, cmd << " WHERE " << where; } + cmd << " ORDER BY oid"; + rc = db->exec(cmd, this); oss << ""; From 1ad6aca0ef0cd472e11462ab2d2f63ca3f9999ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 11 Jan 2012 16:46:57 +0100 Subject: [PATCH 2/2] Feature #862: Add configuration option in oned.conf to enable/disable the management of the permissions for 'other' --- share/etc/oned.conf | 5 +++++ src/rm/RequestManagerChmod.cc | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 65cfb004d3..566e6f5fd9 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -457,6 +457,10 @@ HM_MAD = [ # SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as # valid. During this time, the driver is not used. Use 0 to disable session # caching +# +# ENABLE_OTHER_PERMISSIONS: Whether or not to enable the permissions for +# 'other'. Users in the oneadmin group will still be able to change +# these permissions. Values: YES or NO #******************************************************************************* AUTH_MAD = [ @@ -467,3 +471,4 @@ AUTH_MAD = [ SESSION_EXPIRATION_TIME = 900 +ENABLE_OTHER_PERMISSIONS = "NO" \ No newline at end of file diff --git a/src/rm/RequestManagerChmod.cc b/src/rm/RequestManagerChmod.cc index 544a7f8197..ab76601387 100644 --- a/src/rm/RequestManagerChmod.cc +++ b/src/rm/RequestManagerChmod.cc @@ -42,7 +42,7 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList, PoolObjectSQL * object; string error_str; - if ( att.uid != 0 ) + if ( att.uid != 0 && att.gid != 0) { AuthRequest::Operation op = AuthRequest::MANAGE; PoolObjectAuth perms; @@ -71,6 +71,16 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList, group_a = -1; } + if ( other_u == perms.other_u ) + { + other_u = -1; + } + + if ( other_m == perms.other_m ) + { + other_m = -1; + } + if ( other_a == perms.other_a ) { other_a = -1; @@ -81,6 +91,23 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList, op = AuthRequest::ADMIN; } + if ( other_u != -1 || other_m != -1 || other_a != -1 ) + { + string enable_other; + + Nebula::instance().get_configuration_attribute( + "ENABLE_OTHER_PERMISSIONS", enable_other); + + if ( enable_other != "YES" ) + { + failure_response(AUTHORIZATION, + "Management of 'other' permissions is disabled in oned.conf", + att); + + return; + } + } + AuthRequest ar(att.uid, att.gid); ar.add_auth(op, perms);