- Partly enable tamlin's implementation, just so it doesn't bitrot being #if0-ed.

svn path=/trunk/; revision=30249
This commit is contained in:
Aleksey Bragin 2007-11-07 22:42:34 +00:00
parent 692eaf0a33
commit 6f00345570

View file

@ -319,21 +319,16 @@ static NTSTATUS
CreateLogoffSecurityAttributes( CreateLogoffSecurityAttributes(
OUT PSECURITY_ATTRIBUTES* ppsa) OUT PSECURITY_ATTRIBUTES* ppsa)
{ {
#if 1
ERR("CreateLogoffSecurityAttributes needs implementation!\n");
*ppsa = 0;
return STATUS_UNSUCCESSFUL;
#else
/* The following code is no only incomplete, it's a mess and uncompilable */ /* The following code is no only incomplete, it's a mess and uncompilable */
/* Still, it gives some ideas about data types and functions involved and */ /* Still, it gives some ideas about data types and functions involved and */
/* required to set up a SECURITY_DESCRIPTOR for a SECURITY_ATTRIBUTES */ /* required to set up a SECURITY_DESCRIPTOR for a SECURITY_ATTRIBUTES */
/* instance for a thread, to allow that thread to ImpersonateLoggedOnUser(). */ /* instance for a thread, to allow that thread to ImpersonateLoggedOnUser(). */
/* Specifically THREAD_SET_THREAD_TOKEN is required. */ /* Specifically THREAD_SET_THREAD_TOKEN is required. */
PSECURITY_DESCRIPTOR psd = 0; PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
PSECURITY_ATTRIBUTES psa = 0; PSECURITY_ATTRIBUTES psa = 0;
BYTE* pMem; BYTE* pMem;
PACL pACL; PACL pACL;
EXPLICIT_ACCESS ea[2]; //EXPLICIT_ACCESS ea[2];
*ppsa = NULL; *ppsa = NULL;
@ -374,10 +369,10 @@ CreateLogoffSecurityAttributes(
/* meaning its members must be pointers to other structures, rather */ /* meaning its members must be pointers to other structures, rather */
/* than the relative format using offsets */ /* than the relative format using offsets */
psa = (PSECURITY_ATTRIBUTES)pMem; psa = (PSECURITY_ATTRIBUTES)pMem;
psd = (PSECURITY_DESCRIPTOR)(pMem + sizeof(SECURITY_ATTRIBUTES)); SecurityDescriptor = (PSECURITY_DESCRIPTOR)(pMem + sizeof(SECURITY_ATTRIBUTES));
pACL = (PACL)(((PBYTE)psd) + SECURITY_DESCRIPTOR_MIN_LENGTH); pACL = (PACL)(((PBYTE)SecurityDescriptor) + SECURITY_DESCRIPTOR_MIN_LENGTH);
if (!InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION)) if (!InitializeSecurityDescriptor(SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
{ {
HeapFree(GetProcessHeap(), 0, pMem); HeapFree(GetProcessHeap(), 0, pMem);
DPRINT("Failed to initialize security descriptor for logoff thread!\n"); DPRINT("Failed to initialize security descriptor for logoff thread!\n");
@ -386,6 +381,7 @@ CreateLogoffSecurityAttributes(
// Initialize an EXPLICIT_ACCESS structure for an ACE. // Initialize an EXPLICIT_ACCESS structure for an ACE.
// The ACE will allow this thread to log off (and shut down the system, currently). // The ACE will allow this thread to log off (and shut down the system, currently).
#if 0
ZeroMemory(ea, sizeof(ea)); ZeroMemory(ea, sizeof(ea));
ea[0].grfAccessPermissions = THREAD_SET_THREAD_TOKEN; ea[0].grfAccessPermissions = THREAD_SET_THREAD_TOKEN;
ea[0].grfAccessMode = SET_ACCESS; // GRANT_ACCESS? ea[0].grfAccessMode = SET_ACCESS; // GRANT_ACCESS?
@ -403,15 +399,15 @@ CreateLogoffSecurityAttributes(
HeapFree(GetProcessHeap(), 0, pMem); HeapFree(GetProcessHeap(), 0, pMem);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
#endif
psa->nLength = sizeof(sa); psa->nLength = sizeof(SECURITY_ATTRIBUTES);
psa->lpSecurityDescriptor = psd; psa->lpSecurityDescriptor = SecurityDescriptor;
psa->bInheritHandle = FALSE; psa->bInheritHandle = FALSE;
*ppsa = psa; *ppsa = psa;
return STATUS_SUCCESS; return STATUS_SUCCESS;
#endif
} }
static VOID static VOID