Opened 4 years ago

Last modified 4 years ago

#1058 new change

Refactor the creating of SecurityDescriptor for Pipe

Reported by: sergz Assignee:
Priority: P4 Milestone:
Module: Adblock-Plus-for-Internet-Explorer Keywords:
Cc: Blocked By:
Blocking: Platform: Internet Explorer
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

Description

Background

The security Windows API is not so nice and requires a lot of additional looking after the memory from the developer.
For now in http://codereview.adblockplus.org/5792731695677440/ the problem looks to be fixed, but the memory management is not exception safe and still requires to know about the details.

What to change

The proposal is to create something like

struct SecurityDescriptor : private noncopyable
{
  SECURITY_DESCRIPTOR* value; // nullptr if some error
  std::error_code errorCode;
  static /*unique*/SecurityDescriptorPtr Create(PSID logonSid);
private:
  SecurityDescriptor();
  std::array<uint8_t, SECURITY_DESCRIPTOR_MIN_LENGTH> m_valueMemory;
  SmartType<PACL> m_aclMemory;
  /// SACL is bound to this security descriptor, so we should keep it, while
value is used.
  SmartType<PSECURITY_DESCRIPTOR> m_dummySecurityDescriptorLowMemory;
};

where SmartType<T> properly cleans the resources. At least the idea is to free
them automatically when they are not needed.

Change History (2)

comment:1 Changed 4 years ago by sergz

  • Component changed from Unknown to Adblock-Plus-for-Internet-Explorer
  • Priority changed from Unknown to P4

comment:2 Changed 4 years ago by oleksandr

  • Ready set
Note: See TracTickets for help on using tickets.