From f652a5fbb8fdb4e2505ec381dc6fe0d6abe2e83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Czern=C3=BD?= Date: Thu, 26 Mar 2020 11:16:36 +0100 Subject: [PATCH] B 4416: Fix restricted params for UserTemplate (#4433) * B #4416: Fix restricted params for UserTemplate * M #-: Fix crash on VM action with wrong user --- src/rm/Request.cc | 6 ++---- src/um/UserPool.cc | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/rm/Request.cc b/src/rm/Request.cc index 81d0dcb8ab..ca226c731c 100644 --- a/src/rm/Request.cc +++ b/src/rm/Request.cc @@ -1120,10 +1120,9 @@ void RequestAttributes::set_auth_op(VMActions::Action action) if (user != nullptr) { result = user->get_vm_auth_op(action); + user->unlock(); } - user->unlock(); - if (result != AuthRequest::NONE) { auth_op = result; @@ -1135,10 +1134,9 @@ void RequestAttributes::set_auth_op(VMActions::Action action) if (group != nullptr) { result = group->get_vm_auth_op(action); + group->unlock(); } - group->unlock(); - if (result != AuthRequest::NONE) { auth_op = result; diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index c57f10a170..56acd32602 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -72,6 +72,9 @@ UserPool::UserPool(SqlDB * db, time_t __session_expiration_time, bool is_slave, _session_expiration_time = __session_expiration_time; + // Set restricted attributes + UserTemplate::parse_restricted(restricted_attrs); + User * oneadmin_user = get_ro(0); //Slaves do not need to init the pool, just the oneadmin username @@ -178,9 +181,6 @@ UserPool::UserPool(SqlDB * db, time_t __session_expiration_time, bool is_slave, goto error_serveradmin; } - // Set restricted attributes - UserTemplate::parse_restricted(restricted_attrs); - return; error_readoneauth: