Skip to content
Permalink
Browse files

more 5076 - sync cache

  • Loading branch information...
alabuzhev committed Oct 26, 2017
1 parent d32bb66 commit 51288e386e60125c4169931449d05748e42d4430
Showing with 13 additions and 3 deletions.
  1. +4 −0 far/changelog
  2. +8 −2 far/privilege.cpp
  3. +1 −1 far/vbuild.m4
@@ -1,3 +1,7 @@
drkns 26.10.2017 23:03:02 +0100 - build 5077

1. Уточнение 5076.2 - синхронизация кеширования.

drkns 26.10.2017 20:06:28 +0100 - build 5076

1. С форума: падение на операции удаления с повышением прав.
@@ -35,6 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "privilege.hpp"
#include "lasterror.hpp"
#include "synchro.hpp"


namespace os::security {
@@ -48,8 +49,12 @@ static handle OpenCurrentProcessToken(DWORD DesiredAccess)
static bool lookup_privilege_value(const wchar_t* Name, LUID& Value)
{
using value_type = std::pair<LUID, bool>;
static std::unordered_map<string, value_type> sCache;
auto Result = sCache.emplace(Name, value_type{});
static std::unordered_map<string, value_type> s_Cache;
static os::critical_section s_CS;

SCOPED_ACTION(os::critical_section_lock)(s_CS);

auto Result = s_Cache.emplace(Name, value_type{});

const auto& MapKey = Result.first->first;
auto& MapValue = Result.first->second;
@@ -62,6 +67,7 @@ static bool lookup_privilege_value(const wchar_t* Name, LUID& Value)
Value = MapValue.first;
return MapValue.second;
}

privilege::privilege(const range<const wchar_t* const*>& Names)
{
if (Names.empty())
@@ -1 +1 @@
m4_define(BUILD,5076)m4_dnl
m4_define(BUILD,5077)m4_dnl

0 comments on commit 51288e3

Please sign in to comment.
You can’t perform that action at this time.