+2004-05-15 Jeffrey Altman <jaltman@mit.edu>
+
+ * cc_mslsa.c: The FAILED() macro only considered an error
+ to be a failure if the value is negative. ConstructTicketRequest()
+ returns positive errors. Do not use FAILED() to test the result.
+ Also, fix a potential leak of LSA allocated memory.
+
2004-04-24 Ken Raeburn <raeburn@mit.edu>
* ccbase.c: Include ctype.h.
return Success;
}
-static NTSTATUS
+static DWORD
ConstructTicketRequest(UNICODE_STRING DomainName, PKERB_RETRIEVE_TKT_REQUEST * outRequest, ULONG * outSize)
{
- NTSTATUS Status;
+ DWORD Error;
UNICODE_STRING TargetPrefix;
USHORT TargetSize;
ULONG RequestSize;
pTicketRequest->TargetName.Length = 0;
pTicketRequest->TargetName.MaximumLength = TargetSize;
pTicketRequest->TargetName.Buffer = (PWSTR) (pTicketRequest + 1);
- Status = ConcatenateUnicodeStrings(&(pTicketRequest->TargetName),
+ Error = ConcatenateUnicodeStrings(&(pTicketRequest->TargetName),
TargetPrefix,
DomainName);
*outRequest = pTicketRequest;
*outSize = RequestSize;
- return Status;
+ return Error;
}
static BOOL
BOOL bIsLsaError = FALSE;
NTSTATUS Status = 0;
NTSTATUS SubStatus = 0;
+ DWORD Error;
KERB_QUERY_TKT_CACHE_REQUEST CacheRequest;
PKERB_RETRIEVE_TKT_REQUEST pTicketRequest;
// the required fields are not supported on Windows 2000. :(
if ( supported && GetSecurityLogonSessionData(&pSessionData) ) {
if ( pSessionData->DnsDomainName.Buffer ) {
- Status = ConstructTicketRequest(pSessionData->DnsDomainName,
+ Error = ConstructTicketRequest(pSessionData->DnsDomainName,
&pTicketRequest, &RequestSize);
- if ( FAILED(Status) ) {
+ LsaFreeReturnBuffer(pSessionData);
+ if ( Error )
goto cleanup;
- }
} else {
+ LsaFreeReturnBuffer(pSessionData);
bIsLsaError = TRUE;
goto cleanup;
}
- LsaFreeReturnBuffer(pSessionData);
} else {
CHAR UserDnsDomain[256];
WCHAR UnicodeUserDnsDomain[256];
wrapper.Length = wcslen(UnicodeUserDnsDomain) * sizeof(WCHAR);
wrapper.MaximumLength = 256;
- Status = ConstructTicketRequest(wrapper,
+ Error = ConstructTicketRequest(wrapper,
&pTicketRequest, &RequestSize);
- if ( FAILED(Status) ) {
+ if ( Error )
goto cleanup;
- }
}
} else {
#ifdef PURGE_ALL
}
#endif /* PURGE_ALL */
- Status = ConstructTicketRequest(pTicketResponse->Ticket.TargetDomainName,
+ Error = ConstructTicketRequest(pTicketResponse->Ticket.TargetDomainName,
&pTicketRequest, &RequestSize);
- if ( FAILED(Status) ) {
+ if ( Error ) {
goto cleanup;
}