00039 :
00040
00041 Walks
the list of security descriptors present in
the hive and passes
00042 each security descriptor to
RtlValidSecurityDescriptor.
00043
00044 Only applies to descriptors in
Stable store. Those in
Volatile store
00045 cannot have come from disk and therefore
do not need
this treatment
00046 anyway.
00047
00048 Arguments:
00049
00050
Hive - Supplies pointer to
the hive
control structure
00051
00052 Return Value:
00053
00054
TRUE - All security descriptors are valid
00055
FALSE - At least one security descriptor
is invalid
00056
00057 --*/
00058
00059 {
00060
PCM_KEY_NODE RootNode;
00061
PCM_KEY_SECURITY SecurityCell;
00062
HCELL_INDEX ListAnchor;
00063
HCELL_INDEX NextCell;
00064
HCELL_INDEX LastCell;
00065
00066
CMLOG(CML_FLOW, CMS_SEC) {
00067 KdPrint((
"CmpValidateHiveSecurityDescriptor: Hive = %lx\n",(ULONG_PTR)Hive));
00068 }
00069
if (!
HvIsCellAllocated(Hive,
Hive->
BaseBlock->
RootCell)) {
00070
00071
00072
00073
return(
FALSE);
00074 }
00075 RootNode = (
PCM_KEY_NODE)
HvGetCell(Hive,
Hive->
BaseBlock->
RootCell);
00076 ListAnchor = NextCell = RootNode->
Security;
00077
00078
do {
00079
if (!
HvIsCellAllocated(Hive, NextCell)) {
00080
CMLOG(CML_MAJOR, CMS_SEC) {
00081 KdPrint((
"CM: CmpValidateHiveSecurityDescriptors\n"));
00082 KdPrint((
" NextCell: %08lx is invalid HCELL_INDEX\n",NextCell));
00083 }
00084
return(
FALSE);
00085 }
00086 SecurityCell = (
PCM_KEY_SECURITY)
HvGetCell(Hive, NextCell);
00087
if (NextCell != ListAnchor) {
00088
00089
00090
00091
00092
if (SecurityCell->
Blink != LastCell) {
00093
CMLOG(CML_MAJOR, CMS_SEC) {
00094 KdPrint((
" Invalid Blink (%ld) on security cell %ld\n",SecurityCell->
Blink, NextCell));
00095 KdPrint((
" should point to %ld\n", LastCell));
00096 }
00097
return(
FALSE);
00098 }
00099 }
00100
CMLOG(CML_MINOR, CMS_SEC) {
00101 KdPrint((
"CmpValidSD: SD shared by %d nodes\n",SecurityCell->
ReferenceCount));
00102 }
00103
if (!
SeValidSecurityDescriptor(SecurityCell->
DescriptorLength, &SecurityCell->
Descriptor)) {
00104
CMLOG(CML_MAJOR, CMS_SEC) {
00105
CmpDumpSecurityDescriptor(&SecurityCell->
Descriptor,
"INVALID DESCRIPTOR");
00106 }
00107
return(
FALSE);
00108 }
00109
SetUsed(Hive, NextCell);
00110 LastCell = NextCell;
00111 NextCell = SecurityCell->
Flink;
00112 }
while ( NextCell != ListAnchor );
00113
return(
TRUE);
00114 }
}