Opened on 07/16/2014 at 12:56:06 PM

Last modified on 12/07/2014 at 10:54:35 PM

#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.

Attachments (0)

Change History (2)

comment:1 Changed on 07/16/2014 at 01:32:12 PM by sergz

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

comment:2 Changed on 12/07/2014 at 10:54:35 PM by oleksandr

  • Ready set

Add Comment

Modify Ticket

Change Properties
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from (none).
Next status will be 'reviewing'.
 
Note: See TracTickets for help on using tickets.