mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
[LSASRV]
- Just run again the loop if LsarOpenAccount call failed (that also avoids a call to LsarClose on a NULL handle, that is trapped by the kdbg if one enabled "set condition * first always"). - Free the memory and the opened handles before returning in case of failure of LsapAddPrivilegeToTokenPrivileges. Maybe this cleaning step can be done more elegantly. Eric, can you please review that? It should be good I think. svn path=/trunk/; revision=63496
This commit is contained in:
parent
0d6c552a9d
commit
cb2c49a1ea
1 changed files with 18 additions and 11 deletions
|
@ -1308,23 +1308,30 @@ LsapSetPrivileges(
|
|||
TokenInfo1->Groups->Groups[i].Sid,
|
||||
ACCOUNT_VIEW,
|
||||
&AccountHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
|
||||
Status = LsarEnumeratePrivilegesAccount(AccountHandle,
|
||||
&Privileges);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = LsarEnumeratePrivilegesAccount(AccountHandle,
|
||||
&Privileges);
|
||||
if (NT_SUCCESS(Status))
|
||||
for (j = 0; j < Privileges->PrivilegeCount; j++)
|
||||
{
|
||||
for (j = 0; j < Privileges->PrivilegeCount; j++)
|
||||
Status = LsapAddPrivilegeToTokenPrivileges(&TokenInfo1->Privileges,
|
||||
&(Privileges->Privilege[j]));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Status = LsapAddPrivilegeToTokenPrivileges(&TokenInfo1->Privileges,
|
||||
&(Privileges->Privilege[j]));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
}
|
||||
/* We failed, clean everything and return */
|
||||
LsaIFree_LSAPR_PRIVILEGE_SET(Privileges);
|
||||
LsarClose(&AccountHandle);
|
||||
LsarClose(&PolicyHandle);
|
||||
|
||||
LsaIFree_LSAPR_PRIVILEGE_SET(Privileges);
|
||||
Privileges = NULL;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
LsaIFree_LSAPR_PRIVILEGE_SET(Privileges);
|
||||
Privileges = NULL;
|
||||
}
|
||||
|
||||
LsarClose(&AccountHandle);
|
||||
|
|
Loading…
Reference in a new issue