Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-10-22 18:57:43 +0400
committerCorinna Vinschen <corinna@vinschen.de>2006-10-22 18:57:43 +0400
commit2be593d961e3ccd21a7a19b5a0b716e43d0137dc (patch)
treef0a707df944d7f8ef6c067627209d99dc9ad7907 /winsup/cygwin/security.h
parent2b26c2fc410ad29dbc2e906e98845c06db79e726 (diff)
* external.cc (cygwin_internal): Use security_descriptor::copy method.
* sec_helper.cc (security_descriptor::malloc): Use own free method. Set type. (security_descriptor::realloc): Handle the case that psd has been allocated using LocalAlloc. Set type. (security_descriptor::free): Ditto. * security.cc (get_nt_attribute): Remove. (get_reg_security): Remove. (get_nt_object_security): Use GetSecurityInfo which handles all securable objects. (get_nt_object_attribute): Remove. (get_object_attribute): Call get_nt_object_security instead of get_nt_object_attribute. (get_file_attribute): Ditto. (check_registry_access): Call get_nt_object_security instead of get_reg_security. * security.h (cygpsid::operator PSID): Make method const, not the result. (class security_descriptor): Add type member. Accomodate throughout. (security_descriptor::copy): New method. (security_descriptor::operator PSECURITY_DESCRIPTOR *): New operator.
Diffstat (limited to 'winsup/cygwin/security.h')
-rw-r--r--winsup/cygwin/security.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h
index 94e3cc3f5..2b5b57275 100644
--- a/winsup/cygwin/security.h
+++ b/winsup/cygwin/security.h
@@ -43,7 +43,7 @@ protected:
public:
cygpsid () {}
cygpsid (PSID nsid) { psid = nsid; }
- operator const PSID () { return psid; }
+ operator PSID () const { return psid; }
const PSID operator= (PSID nsid) { return psid = nsid;}
__uid32_t get_id (BOOL search_grp, int *type = NULL);
int get_uid () { return get_id (FALSE); }
@@ -182,16 +182,28 @@ class security_descriptor {
protected:
PSECURITY_DESCRIPTOR psd;
DWORD sd_size;
+ enum { local_alloced, malloced } type;
public:
- security_descriptor () : psd (NULL), sd_size (0) {}
+ security_descriptor () : psd (NULL), sd_size (0), type (local_alloced) {}
~security_descriptor () { free (); }
PSECURITY_DESCRIPTOR malloc (size_t nsize);
PSECURITY_DESCRIPTOR realloc (size_t nsize);
void free ();
- inline DWORD size () const { return sd_size; }
+ inline DWORD size () {
+ if (!sd_size && psd && type == local_alloced)
+ sd_size = LocalSize (psd);
+ return sd_size;
+ }
+ inline DWORD copy (void *buf, DWORD buf_size) {
+ if (buf_size < size ())
+ return sd_size;
+ memcpy (buf, psd, sd_size);
+ return 0;
+ }
inline operator const PSECURITY_DESCRIPTOR () { return psd; }
+ inline operator PSECURITY_DESCRIPTOR *() { return &psd; }
};
class user_groups {