From 6d37414eabc56bccb16290571cfd96374ac36911 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 15 Oct 2003 11:02:04 +0000 Subject: [PATCH] Cleaned up RtlpQuerySecurityDescriptor() and fixed SaclLength. svn path=/trunk/; revision=6322 --- reactos/lib/ntdll/rtl/sd.c | 24 ++++++++++++++---------- reactos/ntoskrnl/se/sd.c | 24 ++++++++++++++---------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/reactos/lib/ntdll/rtl/sd.c b/reactos/lib/ntdll/rtl/sd.c index b198e81d58b..7b719e09c37 100644 --- a/reactos/lib/ntdll/rtl/sd.c +++ b/reactos/lib/ntdll/rtl/sd.c @@ -1,4 +1,4 @@ -/* $Id: sd.c,v 1.12 2003/09/12 17:51:48 vizzini Exp $ +/* $Id: sd.c,v 1.13 2003/10/15 11:00:33 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -392,11 +392,7 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, PACL* Sacl, PULONG SaclLength) { - if (SecurityDescriptor->Owner == NULL) - { - *Owner = NULL; - } - else + if (SecurityDescriptor->Owner != NULL) { *Owner = SecurityDescriptor->Owner; if (SecurityDescriptor->Control & SE_SELF_RELATIVE) @@ -404,6 +400,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, *Owner = (PSID)((ULONG)*Owner + (ULONG)SecurityDescriptor); } } + else + { + *Owner = NULL; + } if (*Owner != NULL) { @@ -438,10 +438,6 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, } if (SecurityDescriptor->Group != NULL) - { - *Group = NULL; - } - else { *Group = SecurityDescriptor->Group; if (SecurityDescriptor->Control & SE_SELF_RELATIVE) @@ -449,6 +445,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, *Group = (PSID)((ULONG)*Group + (ULONG)SecurityDescriptor); } } + else + { + *Group = NULL; + } if (*Group != NULL) { @@ -477,6 +477,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, { *SaclLength = ((*Sacl)->AclSize + 3) & ~3; } + else + { + *SaclLength = 0; + } } diff --git a/reactos/ntoskrnl/se/sd.c b/reactos/ntoskrnl/se/sd.c index 384358e124f..ce46437bbc7 100644 --- a/reactos/ntoskrnl/se/sd.c +++ b/reactos/ntoskrnl/se/sd.c @@ -1,4 +1,4 @@ -/* $Id: sd.c,v 1.11 2003/10/12 17:05:50 hbirr Exp $ +/* $Id: sd.c,v 1.12 2003/10/15 11:02:04 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -601,11 +601,7 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, PACL* Sacl, PULONG SaclLength) { - if (SecurityDescriptor->Owner == NULL) - { - *Owner = NULL; - } - else + if (SecurityDescriptor->Owner != NULL) { *Owner = SecurityDescriptor->Owner; if (SecurityDescriptor->Control & SE_SELF_RELATIVE) @@ -613,6 +609,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, *Owner = (PSID)((ULONG)*Owner + (ULONG)SecurityDescriptor); } } + else + { + *Owner = NULL; + } if (*Owner != NULL) { @@ -647,10 +647,6 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, } if (SecurityDescriptor->Group != NULL) - { - *Group = NULL; - } - else { *Group = SecurityDescriptor->Group; if (SecurityDescriptor->Control & SE_SELF_RELATIVE) @@ -658,6 +654,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, *Group = (PSID)((ULONG)*Group + (ULONG)SecurityDescriptor); } } + else + { + *Group = NULL; + } if (*Group != NULL) { @@ -686,6 +686,10 @@ RtlpQuerySecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor, { *SaclLength = ((*Sacl)->AclSize + 3) & ~3; } + else + { + *SaclLength = 0; + } }