Commit fbd30fff authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

secur32: Use CRT memory allocators.

parent 49dbde22
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
...@@ -32,9 +33,9 @@ ...@@ -32,9 +33,9 @@
#include "ntsecpkg.h" #include "ntsecpkg.h"
#include "winternl.h" #include "winternl.h"
#include "rpc.h" #include "rpc.h"
#include "secur32_priv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "secur32_priv.h"
WINE_DEFAULT_DEBUG_CHANNEL(secur32); WINE_DEFAULT_DEBUG_CHANNEL(secur32);
...@@ -91,7 +92,7 @@ NTSTATUS WINAPI LsaCallAuthenticationPackage(HANDLE lsa_handle, ULONG package_id ...@@ -91,7 +92,7 @@ NTSTATUS WINAPI LsaCallAuthenticationPackage(HANDLE lsa_handle, ULONG package_id
static struct lsa_connection *alloc_lsa_connection(void) static struct lsa_connection *alloc_lsa_connection(void)
{ {
struct lsa_connection *ret; struct lsa_connection *ret;
if (!(ret = heap_alloc(sizeof(*ret)))) return NULL; if (!(ret = malloc(sizeof(*ret)))) return NULL;
ret->magic = LSA_MAGIC; ret->magic = LSA_MAGIC;
return ret; return ret;
} }
...@@ -127,7 +128,7 @@ NTSTATUS WINAPI LsaDeregisterLogonProcess(HANDLE LsaHandle) ...@@ -127,7 +128,7 @@ NTSTATUS WINAPI LsaDeregisterLogonProcess(HANDLE LsaHandle)
if (!lsa_conn || lsa_conn->magic != LSA_MAGIC) return STATUS_INVALID_HANDLE; if (!lsa_conn || lsa_conn->magic != LSA_MAGIC) return STATUS_INVALID_HANDLE;
lsa_conn->magic = 0; lsa_conn->magic = 0;
heap_free(lsa_conn); free(lsa_conn);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -145,7 +146,7 @@ NTSTATUS WINAPI LsaEnumerateLogonSessions(PULONG LogonSessionCount, ...@@ -145,7 +146,7 @@ NTSTATUS WINAPI LsaEnumerateLogonSessions(PULONG LogonSessionCount,
NTSTATUS WINAPI LsaFreeReturnBuffer(PVOID buffer) NTSTATUS WINAPI LsaFreeReturnBuffer(PVOID buffer)
{ {
TRACE("%p\n", buffer); TRACE("%p\n", buffer);
heap_free(buffer); free(buffer);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -209,26 +210,26 @@ static NTSTATUS NTAPI lsa_DeleteCredential(LUID *logon_id, ULONG package_id, LSA ...@@ -209,26 +210,26 @@ static NTSTATUS NTAPI lsa_DeleteCredential(LUID *logon_id, ULONG package_id, LSA
static void * NTAPI lsa_AllocateLsaHeap(ULONG size) static void * NTAPI lsa_AllocateLsaHeap(ULONG size)
{ {
TRACE("%u\n", size); TRACE("%u\n", size);
return heap_alloc(size); return malloc(size);
} }
static void NTAPI lsa_FreeLsaHeap(void *p) static void NTAPI lsa_FreeLsaHeap(void *p)
{ {
TRACE("%p\n", p); TRACE("%p\n", p);
heap_free(p); free(p);
} }
static NTSTATUS NTAPI lsa_AllocateClientBuffer(PLSA_CLIENT_REQUEST req, ULONG size, void **p) static NTSTATUS NTAPI lsa_AllocateClientBuffer(PLSA_CLIENT_REQUEST req, ULONG size, void **p)
{ {
TRACE("%p,%u,%p\n", req, size, p); TRACE("%p,%u,%p\n", req, size, p);
*p = heap_alloc(size); *p = malloc(size);
return *p ? STATUS_SUCCESS : STATUS_NO_MEMORY; return *p ? STATUS_SUCCESS : STATUS_NO_MEMORY;
} }
static NTSTATUS NTAPI lsa_FreeClientBuffer(PLSA_CLIENT_REQUEST req, void *p) static NTSTATUS NTAPI lsa_FreeClientBuffer(PLSA_CLIENT_REQUEST req, void *p)
{ {
TRACE("%p,%p\n", req, p); TRACE("%p,%p\n", req, p);
heap_free(p); free(p);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -351,13 +352,13 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA( ...@@ -351,13 +352,13 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA(
if (principal) if (principal)
{ {
int len = MultiByteToWideChar( CP_ACP, 0, principal, -1, NULL, 0 ); int len = MultiByteToWideChar( CP_ACP, 0, principal, -1, NULL, 0 );
if (!(principalW = heap_alloc( len * sizeof(SEC_WCHAR) ))) goto done; if (!(principalW = malloc( len * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, principal, -1, principalW, len ); MultiByteToWideChar( CP_ACP, 0, principal, -1, principalW, len );
} }
if (package) if (package)
{ {
int len = MultiByteToWideChar( CP_ACP, 0, package, -1, NULL, 0 ); int len = MultiByteToWideChar( CP_ACP, 0, package, -1, NULL, 0 );
if (!(packageW = heap_alloc( len * sizeof(SEC_WCHAR) ))) goto done; if (!(packageW = malloc( len * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, package, -1, packageW, len ); MultiByteToWideChar( CP_ACP, 0, package, -1, packageW, len );
} }
if (auth_data) if (auth_data)
...@@ -366,23 +367,23 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA( ...@@ -366,23 +367,23 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA(
if (id->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI) if (id->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)
{ {
if (!(auth_dataW = heap_alloc( sizeof(SEC_WINNT_AUTH_IDENTITY_W) ))) goto done; if (!(auth_dataW = malloc( sizeof(SEC_WINNT_AUTH_IDENTITY_W) ))) goto done;
if (id->UserLength) if (id->UserLength)
{ {
len_user = MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, NULL, 0 ); len_user = MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, NULL, 0 );
if (!(user = heap_alloc( len_user * sizeof(SEC_WCHAR) ))) goto done; if (!(user = malloc( len_user * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, user, len_user ); MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, user, len_user );
} }
if (id->DomainLength) if (id->DomainLength)
{ {
len_domain = MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, NULL, 0 ); len_domain = MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, NULL, 0 );
if (!(domain = heap_alloc( len_domain * sizeof(SEC_WCHAR) ))) goto done; if (!(domain = malloc( len_domain * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, domain, len_domain ); MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, domain, len_domain );
} }
if (id->PasswordLength) if (id->PasswordLength)
{ {
len_passwd = MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, NULL, 0 ); len_passwd = MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, NULL, 0 );
if (!(passwd = heap_alloc( len_passwd * sizeof(SEC_WCHAR) ))) goto done; if (!(passwd = malloc( len_passwd * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, passwd, len_passwd ); MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, passwd, len_passwd );
} }
auth_dataW->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; auth_dataW->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
...@@ -399,12 +400,12 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA( ...@@ -399,12 +400,12 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA(
status = lsa_AcquireCredentialsHandleW( principalW, packageW, credentials_use, logon_id, auth_dataW, get_key_fn, status = lsa_AcquireCredentialsHandleW( principalW, packageW, credentials_use, logon_id, auth_dataW, get_key_fn,
get_key_arg, credential, ts_expiry ); get_key_arg, credential, ts_expiry );
done: done:
if (auth_dataW != (SEC_WINNT_AUTH_IDENTITY_W *)id) heap_free( auth_dataW ); if (auth_dataW != (SEC_WINNT_AUTH_IDENTITY_W *)id) free( auth_dataW );
heap_free( packageW ); free( packageW );
heap_free( principalW ); free( principalW );
heap_free( user ); free( user );
heap_free( domain ); free( domain );
heap_free( passwd ); free( passwd );
return status; return status;
} }
...@@ -487,13 +488,13 @@ static SECURITY_STATUS WINAPI lsa_InitializeSecurityContextA( ...@@ -487,13 +488,13 @@ static SECURITY_STATUS WINAPI lsa_InitializeSecurityContextA(
if (target_name) if (target_name)
{ {
int len = MultiByteToWideChar( CP_ACP, 0, target_name, -1, NULL, 0 ); int len = MultiByteToWideChar( CP_ACP, 0, target_name, -1, NULL, 0 );
if (!(targetW = heap_alloc( len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(targetW = malloc( len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY;
MultiByteToWideChar( CP_ACP, 0, target_name, -1, targetW, len ); MultiByteToWideChar( CP_ACP, 0, target_name, -1, targetW, len );
} }
status = lsa_InitializeSecurityContextW( credential, context, targetW, context_req, reserved1, target_data_rep, status = lsa_InitializeSecurityContextW( credential, context, targetW, context_req, reserved1, target_data_rep,
input, reserved2, new_context, output, context_attr, ts_expiry ); input, reserved2, new_context, output, context_attr, ts_expiry );
heap_free( targetW ); free( targetW );
return status; return status;
} }
...@@ -583,7 +584,8 @@ static SecPkgInfoA *package_infoWtoA( const SecPkgInfoW *info ) ...@@ -583,7 +584,8 @@ static SecPkgInfoA *package_infoWtoA( const SecPkgInfoW *info )
int size_name = WideCharToMultiByte( CP_ACP, 0, info->Name, -1, NULL, 0, NULL, NULL ); int size_name = WideCharToMultiByte( CP_ACP, 0, info->Name, -1, NULL, 0, NULL, NULL );
int size_comment = WideCharToMultiByte( CP_ACP, 0, info->Comment, -1, NULL, 0, NULL, NULL ); int size_comment = WideCharToMultiByte( CP_ACP, 0, info->Comment, -1, NULL, 0, NULL, NULL );
if (!(ret = heap_alloc( sizeof(*ret) + size_name + size_comment ))) return NULL; /* freed with FreeContextBuffer */
if (!(ret = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*ret) + size_name + size_comment ))) return NULL;
ret->fCapabilities = info->fCapabilities; ret->fCapabilities = info->fCapabilities;
ret->wVersion = info->wVersion; ret->wVersion = info->wVersion;
ret->wRPCID = info->wRPCID; ret->wRPCID = info->wRPCID;
...@@ -801,9 +803,9 @@ static void add_package(struct lsa_package *package) ...@@ -801,9 +803,9 @@ static void add_package(struct lsa_package *package)
struct lsa_package *new_loaded_packages; struct lsa_package *new_loaded_packages;
if (!loaded_packages) if (!loaded_packages)
new_loaded_packages = heap_alloc(sizeof(*new_loaded_packages)); new_loaded_packages = malloc(sizeof(*new_loaded_packages));
else else
new_loaded_packages = heap_realloc(loaded_packages, sizeof(*new_loaded_packages) * (loaded_packages_count + 1)); new_loaded_packages = realloc(loaded_packages, sizeof(*new_loaded_packages) * (loaded_packages_count + 1));
if (new_loaded_packages) if (new_loaded_packages)
{ {
...@@ -904,7 +906,7 @@ void load_auth_packages(void) ...@@ -904,7 +906,7 @@ void load_auth_packages(void)
{ {
SecPkgInfoW *info; SecPkgInfoW *info;
info = heap_alloc(loaded_packages[i].lsa_table_count * sizeof(*info)); info = malloc(loaded_packages[i].lsa_table_count * sizeof(*info));
if (info) if (info)
{ {
NTSTATUS status; NTSTATUS status;
...@@ -913,7 +915,7 @@ void load_auth_packages(void) ...@@ -913,7 +915,7 @@ void load_auth_packages(void)
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
SECUR32_addPackages(provider, loaded_packages[i].lsa_table_count, NULL, info); SECUR32_addPackages(provider, loaded_packages[i].lsa_table_count, NULL, info);
heap_free(info); free(info);
} }
} }
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "sspi.h" #include "sspi.h"
...@@ -78,7 +79,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleW( ...@@ -78,7 +79,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleW(
pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry); pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
if (!pszPackage) return SEC_E_SECPKG_NOT_FOUND; if (!pszPackage) return SEC_E_SECPKG_NOT_FOUND;
if (!(cred = heap_alloc_zero( sizeof(*cred) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(cred = calloc( 1, sizeof(*cred) ))) return SEC_E_INSUFFICIENT_MEMORY;
if ((package = SECUR32_findPackageW( kerberosW ))) if ((package = SECUR32_findPackageW( kerberosW )))
{ {
...@@ -103,7 +104,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleW( ...@@ -103,7 +104,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleW(
return SEC_E_OK; return SEC_E_OK;
} }
heap_free( cred ); free( cred );
return ret; return ret;
} }
...@@ -126,7 +127,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA( ...@@ -126,7 +127,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
if (pszPackage) if (pszPackage)
{ {
int package_len = MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, NULL, 0 ); int package_len = MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, NULL, 0 );
if (!(package = heap_alloc( package_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(package = malloc( package_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY;
MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, package, package_len ); MultiByteToWideChar( CP_ACP, 0, pszPackage, -1, package, package_len );
} }
if (pAuthData) if (pAuthData)
...@@ -136,14 +137,14 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA( ...@@ -136,14 +137,14 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
if (identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI) if (identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)
{ {
if (!(identityW = heap_alloc( sizeof(*identityW) ))) goto done; if (!(identityW = malloc( sizeof(*identityW) ))) goto done;
if (!identity->UserLength) user_len = 0; if (!identity->UserLength) user_len = 0;
else else
{ {
user_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User, user_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User,
identity->UserLength, NULL, 0 ); identity->UserLength, NULL, 0 );
if (!(user = heap_alloc( user_len * sizeof(SEC_WCHAR) ))) goto done; if (!(user = malloc( user_len * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User, identity->UserLength, MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->User, identity->UserLength,
user, user_len ); user, user_len );
} }
...@@ -152,7 +153,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA( ...@@ -152,7 +153,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
{ {
domain_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain, domain_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain,
identity->DomainLength, NULL, 0 ); identity->DomainLength, NULL, 0 );
if (!(domain = heap_alloc( domain_len * sizeof(SEC_WCHAR) ))) goto done; if (!(domain = malloc( domain_len * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain, identity->DomainLength, MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Domain, identity->DomainLength,
domain, domain_len ); domain, domain_len );
} }
...@@ -161,7 +162,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA( ...@@ -161,7 +162,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
{ {
passwd_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password, passwd_len = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password,
identity->PasswordLength, NULL, 0 ); identity->PasswordLength, NULL, 0 );
if (!(passwd = heap_alloc( passwd_len * sizeof(SEC_WCHAR) ))) goto done; if (!(passwd = malloc( passwd_len * sizeof(SEC_WCHAR) ))) goto done;
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password, identity->PasswordLength, MultiByteToWideChar( CP_ACP, 0, (LPCSTR)identity->Password, identity->PasswordLength,
passwd, passwd_len ); passwd, passwd_len );
} }
...@@ -178,11 +179,11 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA( ...@@ -178,11 +179,11 @@ static SECURITY_STATUS SEC_ENTRY nego_AcquireCredentialsHandleA(
ret = nego_AcquireCredentialsHandleW( NULL, package, fCredentialUse, pLogonID, identityW, ret = nego_AcquireCredentialsHandleW( NULL, package, fCredentialUse, pLogonID, identityW,
pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry ); pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry );
done: done:
heap_free( package ); free( package );
heap_free( user ); free( user );
heap_free( domain ); free( domain );
heap_free( passwd ); free( passwd );
heap_free( identityW ); free( identityW );
return ret; return ret;
} }
...@@ -210,7 +211,7 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextW( ...@@ -210,7 +211,7 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextW(
else if (phCredential) else if (phCredential)
{ {
handle = cred = (struct sec_handle *)phCredential->dwLower; handle = cred = (struct sec_handle *)phCredential->dwLower;
if (!(new_ctxt = ctxt = heap_alloc_zero( sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(new_ctxt = ctxt = calloc( 1, sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY;
ctxt->krb = cred->krb; ctxt->krb = cred->krb;
ctxt->ntlm = cred->ntlm; ctxt->ntlm = cred->ntlm;
} }
...@@ -244,7 +245,7 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextW( ...@@ -244,7 +245,7 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextW(
} }
} }
heap_free( new_ctxt ); free( new_ctxt );
return ret; return ret;
} }
...@@ -268,13 +269,13 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextA( ...@@ -268,13 +269,13 @@ static SECURITY_STATUS SEC_ENTRY nego_InitializeSecurityContextA(
if (pszTargetName) if (pszTargetName)
{ {
int target_len = MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, NULL, 0 ); int target_len = MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, NULL, 0 );
if (!(target = heap_alloc( target_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(target = malloc( target_len * sizeof(SEC_WCHAR) ))) return SEC_E_INSUFFICIENT_MEMORY;
MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, target, target_len ); MultiByteToWideChar( CP_ACP, 0, pszTargetName, -1, target, target_len );
} }
ret = nego_InitializeSecurityContextW( phCredential, phContext, target, fContextReq, ret = nego_InitializeSecurityContextW( phCredential, phContext, target, fContextReq,
Reserved1, TargetDataRep, pInput, Reserved2, Reserved1, TargetDataRep, pInput, Reserved2,
phNewContext, pOutput, pfContextAttr, ptsExpiry ); phNewContext, pOutput, pfContextAttr, ptsExpiry );
heap_free( target ); free( target );
return ret; return ret;
} }
...@@ -300,7 +301,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcceptSecurityContext( ...@@ -300,7 +301,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcceptSecurityContext(
else if (phCredential) else if (phCredential)
{ {
handle = cred = (struct sec_handle *)phCredential->dwLower; handle = cred = (struct sec_handle *)phCredential->dwLower;
if (!(new_ctxt = ctxt = heap_alloc_zero( sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY; if (!(new_ctxt = ctxt = calloc( 1, sizeof(*ctxt) ))) return SEC_E_INSUFFICIENT_MEMORY;
ctxt->krb = cred->krb; ctxt->krb = cred->krb;
ctxt->ntlm = cred->ntlm; ctxt->ntlm = cred->ntlm;
} }
...@@ -334,7 +335,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcceptSecurityContext( ...@@ -334,7 +335,7 @@ static SECURITY_STATUS SEC_ENTRY nego_AcceptSecurityContext(
} }
} }
heap_free( new_ctxt ); free( new_ctxt );
return ret; return ret;
} }
...@@ -374,7 +375,7 @@ static SECURITY_STATUS SEC_ENTRY nego_DeleteSecurityContext(PCtxtHandle phContex ...@@ -374,7 +375,7 @@ static SECURITY_STATUS SEC_ENTRY nego_DeleteSecurityContext(PCtxtHandle phContex
ret = ctxt->ntlm->fnTableW.DeleteSecurityContext( &ctxt->handle_ntlm ); ret = ctxt->ntlm->fnTableW.DeleteSecurityContext( &ctxt->handle_ntlm );
} }
TRACE( "freeing %p\n", ctxt ); TRACE( "freeing %p\n", ctxt );
heap_free( ctxt ); free( ctxt );
return ret; return ret;
} }
...@@ -533,7 +534,7 @@ static SECURITY_STATUS SEC_ENTRY nego_FreeCredentialsHandle(PCredHandle phCreden ...@@ -533,7 +534,7 @@ static SECURITY_STATUS SEC_ENTRY nego_FreeCredentialsHandle(PCredHandle phCreden
if (cred->krb) cred->krb->fnTableW.FreeCredentialsHandle( &cred->handle_krb ); if (cred->krb) cred->krb->fnTableW.FreeCredentialsHandle( &cred->handle_krb );
if (cred->ntlm) cred->ntlm->fnTableW.FreeCredentialsHandle( &cred->handle_ntlm ); if (cred->ntlm) cred->ntlm->fnTableW.FreeCredentialsHandle( &cred->handle_ntlm );
heap_free( cred ); free( cred );
return SEC_E_OK; return SEC_E_OK;
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <errno.h> #include <errno.h>
#define NONAMELESSUNION #define NONAMELESSUNION
...@@ -98,7 +99,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type) ...@@ -98,7 +99,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type)
{ {
/* Grow the table */ /* Grow the table */
SIZE_T new_size = schan_handle_table_size + (schan_handle_table_size >> 1); SIZE_T new_size = schan_handle_table_size + (schan_handle_table_size >> 1);
struct schan_handle *new_table = heap_realloc(schan_handle_table, new_size * sizeof(*schan_handle_table)); struct schan_handle *new_table = realloc(schan_handle_table, new_size * sizeof(*schan_handle_table));
if (!new_table) if (!new_table)
{ {
ERR("Failed to grow the handle table\n"); ERR("Failed to grow the handle table\n");
...@@ -521,7 +522,7 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan ...@@ -521,7 +522,7 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan
return SEC_E_NO_AUTHENTICATING_AUTHORITY; return SEC_E_NO_AUTHENTICATING_AUTHORITY;
} }
if (!(creds = heap_alloc(sizeof(*creds)))) return SEC_E_INSUFFICIENT_MEMORY; if (!(creds = malloc(sizeof(*creds)))) return SEC_E_INSUFFICIENT_MEMORY;
creds->credential_use = SECPKG_CRED_OUTBOUND; creds->credential_use = SECPKG_CRED_OUTBOUND;
creds->enabled_protocols = enabled_protocols; creds->enabled_protocols = enabled_protocols;
...@@ -545,7 +546,7 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan ...@@ -545,7 +546,7 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan
return status; return status;
fail: fail:
heap_free(creds); free(creds);
RtlFreeHeap(GetProcessHeap(), 0, key_blob.pbData); RtlFreeHeap(GetProcessHeap(), 0, key_blob.pbData);
return SEC_E_INTERNAL_ERROR; return SEC_E_INTERNAL_ERROR;
} }
...@@ -566,14 +567,13 @@ static SECURITY_STATUS schan_AcquireServerCredentials(const SCHANNEL_CRED *schan ...@@ -566,14 +567,13 @@ static SECURITY_STATUS schan_AcquireServerCredentials(const SCHANNEL_CRED *schan
ULONG_PTR handle; ULONG_PTR handle;
struct schan_credentials *creds; struct schan_credentials *creds;
creds = heap_alloc_zero(sizeof(*creds)); if (!(creds = calloc(1, sizeof(*creds)))) return SEC_E_INSUFFICIENT_MEMORY;
if (!creds) return SEC_E_INSUFFICIENT_MEMORY;
creds->credential_use = SECPKG_CRED_INBOUND; creds->credential_use = SECPKG_CRED_INBOUND;
handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED); handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
if (handle == SCHAN_INVALID_HANDLE) if (handle == SCHAN_INVALID_HANDLE)
{ {
heap_free(creds); free(creds);
return SEC_E_INTERNAL_ERROR; return SEC_E_INTERNAL_ERROR;
} }
...@@ -636,7 +636,7 @@ static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle( ...@@ -636,7 +636,7 @@ static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle(
if (!creds) return SEC_E_INVALID_HANDLE; if (!creds) return SEC_E_INVALID_HANDLE;
if (creds->credential_use == SECPKG_CRED_OUTBOUND) schan_funcs->free_certificate_credentials(creds); if (creds->credential_use == SECPKG_CRED_OUTBOUND) schan_funcs->free_certificate_credentials(creds);
heap_free(creds); free(creds);
return SEC_E_OK; return SEC_E_OK;
} }
...@@ -675,10 +675,10 @@ static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T mi ...@@ -675,10 +675,10 @@ static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T mi
while (new_size < min_size) new_size *= 2; while (new_size < min_size) new_size *= 2;
if (b->pvBuffer) if (b->pvBuffer) /* freed with FreeContextBuffer */
new_data = heap_realloc(b->pvBuffer, new_size); new_data = RtlReAllocateHeap(GetProcessHeap(), 0, b->pvBuffer, new_size);
else else
new_data = heap_alloc(new_size); new_data = RtlAllocateHeap(GetProcessHeap(), 0, new_size);
if (!new_data) if (!new_data)
{ {
...@@ -925,21 +925,20 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( ...@@ -925,21 +925,20 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
return SEC_E_INVALID_HANDLE; return SEC_E_INVALID_HANDLE;
} }
ctx = heap_alloc(sizeof(*ctx)); if (!(ctx = malloc(sizeof(*ctx)))) return SEC_E_INSUFFICIENT_MEMORY;
if (!ctx) return SEC_E_INSUFFICIENT_MEMORY;
ctx->cert = NULL; ctx->cert = NULL;
handle = schan_alloc_handle(ctx, SCHAN_HANDLE_CTX); handle = schan_alloc_handle(ctx, SCHAN_HANDLE_CTX);
if (handle == SCHAN_INVALID_HANDLE) if (handle == SCHAN_INVALID_HANDLE)
{ {
heap_free(ctx); free(ctx);
return SEC_E_INTERNAL_ERROR; return SEC_E_INTERNAL_ERROR;
} }
if (!schan_funcs->create_session(&ctx->session, cred)) if (!schan_funcs->create_session(&ctx->session, cred))
{ {
schan_free_handle(handle, SCHAN_HANDLE_CTX); schan_free_handle(handle, SCHAN_HANDLE_CTX);
heap_free(ctx); free(ctx);
return SEC_E_INTERNAL_ERROR; return SEC_E_INTERNAL_ERROR;
} }
...@@ -954,13 +953,13 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( ...@@ -954,13 +953,13 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
if (pszTargetName && *pszTargetName) if (pszTargetName && *pszTargetName)
{ {
UINT len = WideCharToMultiByte( CP_UNIXCP, 0, pszTargetName, -1, NULL, 0, NULL, NULL ); UINT len = WideCharToMultiByte( CP_UNIXCP, 0, pszTargetName, -1, NULL, 0, NULL, NULL );
char *target = heap_alloc( len ); char *target = malloc( len );
if (target) if (target)
{ {
WideCharToMultiByte( CP_UNIXCP, 0, pszTargetName, -1, target, len, NULL, NULL ); WideCharToMultiByte( CP_UNIXCP, 0, pszTargetName, -1, target, len, NULL, NULL );
schan_funcs->set_session_target( ctx->session, target ); schan_funcs->set_session_target( ctx->session, target );
heap_free( target ); free( target );
} }
} }
...@@ -1077,7 +1076,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA( ...@@ -1077,7 +1076,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
if (pszTargetName) if (pszTargetName)
{ {
INT len = MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, NULL, 0);
if (!(target_name = heap_alloc(len * sizeof(*target_name)))) return SEC_E_INSUFFICIENT_MEMORY; if (!(target_name = malloc(len * sizeof(*target_name)))) return SEC_E_INSUFFICIENT_MEMORY;
MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, target_name, len); MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, target_name, len);
} }
...@@ -1085,7 +1084,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA( ...@@ -1085,7 +1084,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
fContextReq, Reserved1, TargetDataRep, pInput, Reserved2, fContextReq, Reserved1, TargetDataRep, pInput, Reserved2,
phNewContext, pOutput, pfContextAttr, ptsExpiry); phNewContext, pOutput, pfContextAttr, ptsExpiry);
heap_free(target_name); free(target_name);
return ret; return ret;
} }
...@@ -1244,7 +1243,8 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( ...@@ -1244,7 +1243,8 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
return GetLastError(); return GetLastError();
bindings->BindingsLength = sizeof(*bindings->Bindings) + sizeof(prefix)-1 + hash_size; bindings->BindingsLength = sizeof(*bindings->Bindings) + sizeof(prefix)-1 + hash_size;
bindings->Bindings = heap_alloc_zero(bindings->BindingsLength); /* freed with FreeContextBuffer */
bindings->Bindings = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, bindings->BindingsLength);
if(!bindings->Bindings) if(!bindings->Bindings)
return SEC_E_INSUFFICIENT_MEMORY; return SEC_E_INSUFFICIENT_MEMORY;
...@@ -1386,7 +1386,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle ...@@ -1386,7 +1386,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
buffer = &message->pBuffers[idx]; buffer = &message->pBuffers[idx];
data_size = buffer->cbBuffer; data_size = buffer->cbBuffer;
data = heap_alloc(data_size); data = malloc(data_size);
memcpy(data, buffer->pvBuffer, data_size); memcpy(data, buffer->pvBuffer, data_size);
if (schan_find_sec_buffer_idx(message, 0, SECBUFFER_STREAM_HEADER) != -1) if (schan_find_sec_buffer_idx(message, 0, SECBUFFER_STREAM_HEADER) != -1)
...@@ -1404,7 +1404,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle ...@@ -1404,7 +1404,7 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle
b = &ctx->transport.out; b = &ctx->transport.out;
b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset; b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset;
heap_free(data); free(data);
TRACE("Returning %#x.\n", status); TRACE("Returning %#x.\n", status);
...@@ -1520,7 +1520,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1520,7 +1520,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
} }
data_size = expected_size - ctx->header_size; data_size = expected_size - ctx->header_size;
data = heap_alloc(data_size); data = malloc(data_size);
init_schan_buffers(&ctx->transport.in, message, schan_decrypt_message_get_next_buffer); init_schan_buffers(&ctx->transport.in, message, schan_decrypt_message_get_next_buffer);
ctx->transport.in.limit = expected_size; ctx->transport.in.limit = expected_size;
...@@ -1541,7 +1541,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1541,7 +1541,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
if (status != SEC_E_OK) if (status != SEC_E_OK)
{ {
heap_free(data); free(data);
ERR("Returning %x\n", status); ERR("Returning %x\n", status);
return status; return status;
} }
...@@ -1555,7 +1555,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle ...@@ -1555,7 +1555,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle
TRACE("Received %ld bytes\n", received); TRACE("Received %ld bytes\n", received);
memcpy(buf_ptr + ctx->header_size, data, received); memcpy(buf_ptr + ctx->header_size, data, received);
heap_free(data); free(data);
schan_decrypt_fill_buffer(message, SECBUFFER_DATA, schan_decrypt_fill_buffer(message, SECBUFFER_DATA,
buf_ptr + ctx->header_size, received); buf_ptr + ctx->header_size, received);
...@@ -1586,7 +1586,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DeleteSecurityContext(PCtxtHandle context ...@@ -1586,7 +1586,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DeleteSecurityContext(PCtxtHandle context
if (ctx->cert) CertFreeCertificateContext(ctx->cert); if (ctx->cert) CertFreeCertificateContext(ctx->cert);
schan_funcs->dispose_session(ctx->session); schan_funcs->dispose_session(ctx->session);
heap_free(ctx); free(ctx);
return SEC_E_OK; return SEC_E_OK;
} }
...@@ -1597,7 +1597,7 @@ static const SecurityFunctionTableA schanTableA = { ...@@ -1597,7 +1597,7 @@ static const SecurityFunctionTableA schanTableA = {
schan_AcquireCredentialsHandleA, schan_AcquireCredentialsHandleA,
schan_FreeCredentialsHandle, schan_FreeCredentialsHandle,
NULL, /* Reserved2 */ NULL, /* Reserved2 */
schan_InitializeSecurityContextA, schan_InitializeSecurityContextA,
NULL, /* AcceptSecurityContext */ NULL, /* AcceptSecurityContext */
NULL, /* CompleteAuthToken */ NULL, /* CompleteAuthToken */
schan_DeleteSecurityContext, schan_DeleteSecurityContext,
...@@ -1628,7 +1628,7 @@ static const SecurityFunctionTableW schanTableW = { ...@@ -1628,7 +1628,7 @@ static const SecurityFunctionTableW schanTableW = {
schan_AcquireCredentialsHandleW, schan_AcquireCredentialsHandleW,
schan_FreeCredentialsHandle, schan_FreeCredentialsHandle,
NULL, /* Reserved2 */ NULL, /* Reserved2 */
schan_InitializeSecurityContextW, schan_InitializeSecurityContextW,
NULL, /* AcceptSecurityContext */ NULL, /* AcceptSecurityContext */
NULL, /* CompleteAuthToken */ NULL, /* CompleteAuthToken */
schan_DeleteSecurityContext, schan_DeleteSecurityContext,
...@@ -1691,7 +1691,7 @@ void SECUR32_initSchannelSP(void) ...@@ -1691,7 +1691,7 @@ void SECUR32_initSchannelSP(void)
return; return;
} }
schan_handle_table = heap_alloc(64 * sizeof(*schan_handle_table)); schan_handle_table = malloc(64 * sizeof(*schan_handle_table));
if (!schan_handle_table) if (!schan_handle_table)
{ {
ERR("Failed to allocate schannel handle table.\n"); ERR("Failed to allocate schannel handle table.\n");
...@@ -1710,7 +1710,7 @@ void SECUR32_initSchannelSP(void) ...@@ -1710,7 +1710,7 @@ void SECUR32_initSchannelSP(void)
return; return;
fail: fail:
heap_free(schan_handle_table); free(schan_handle_table);
schan_handle_table = NULL; schan_handle_table = NULL;
return; return;
} }
...@@ -1729,7 +1729,7 @@ void SECUR32_deinitSchannelSP(void) ...@@ -1729,7 +1729,7 @@ void SECUR32_deinitSchannelSP(void)
{ {
struct schan_context *ctx = schan_free_handle(i, SCHAN_HANDLE_CTX); struct schan_context *ctx = schan_free_handle(i, SCHAN_HANDLE_CTX);
schan_funcs->dispose_session(ctx->session); schan_funcs->dispose_session(ctx->session);
heap_free(ctx); free(ctx);
} }
} }
i = schan_handle_count; i = schan_handle_count;
...@@ -1740,10 +1740,10 @@ void SECUR32_deinitSchannelSP(void) ...@@ -1740,10 +1740,10 @@ void SECUR32_deinitSchannelSP(void)
struct schan_credentials *cred; struct schan_credentials *cred;
cred = schan_free_handle(i, SCHAN_HANDLE_CRED); cred = schan_free_handle(i, SCHAN_HANDLE_CRED);
schan_funcs->free_certificate_credentials(cred); schan_funcs->free_certificate_credentials(cred);
heap_free(cred); free(cred);
} }
} }
heap_free(schan_handle_table); free(schan_handle_table);
__wine_init_unix_lib(hsecur32, DLL_PROCESS_DETACH, NULL, NULL); __wine_init_unix_lib(hsecur32, DLL_PROCESS_DETACH, NULL, NULL);
schan_funcs = NULL; schan_funcs = NULL;
......
...@@ -174,56 +174,10 @@ PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void) ...@@ -174,56 +174,10 @@ PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void)
return &securityFunctionTableW; return &securityFunctionTableW;
} }
static WCHAR *SECUR32_strdupW(const WCHAR *str) static WCHAR *strdupW( const WCHAR *str )
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
if (str && (ret = heap_alloc((wcslen(str) + 1) * sizeof(WCHAR)))) wcscpy(ret, str); if (str && (ret = malloc( (wcslen(str) + 1) * sizeof(WCHAR) ))) wcscpy( ret, str );
return ret;
}
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str)
{
PWSTR ret;
if (str)
{
int charsNeeded = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
if (charsNeeded)
{
ret = heap_alloc(charsNeeded * sizeof(WCHAR));
if (ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded);
}
else
ret = NULL;
}
else
ret = NULL;
return ret;
}
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str)
{
PSTR ret;
if (str)
{
int charsNeeded = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0,
NULL, NULL);
if (charsNeeded)
{
ret = heap_alloc(charsNeeded);
if (ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded,
NULL, NULL);
}
else
ret = NULL;
}
else
ret = NULL;
return ret; return ret;
} }
...@@ -369,6 +323,17 @@ static void _makeFnTableW(PSecurityFunctionTableW fnTableW, ...@@ -369,6 +323,17 @@ static void _makeFnTableW(PSecurityFunctionTableW fnTableW,
} }
} }
static WCHAR *strdupAW( const char *str )
{
WCHAR *ret = NULL;
if (str)
{
int len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
if ((ret = malloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
}
return ret;
}
static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA,
const SecPkgInfoW *inInfoW) const SecPkgInfoW *inInfoW)
{ {
...@@ -380,13 +345,13 @@ static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, ...@@ -380,13 +345,13 @@ static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA,
memcpy(info, inInfoW ? inInfoW : (const SecPkgInfoW *)inInfoA, sizeof(*info)); memcpy(info, inInfoW ? inInfoW : (const SecPkgInfoW *)inInfoA, sizeof(*info));
if (inInfoW) if (inInfoW)
{ {
info->Name = SECUR32_strdupW(inInfoW->Name); info->Name = strdupW(inInfoW->Name);
info->Comment = SECUR32_strdupW(inInfoW->Comment); info->Comment = strdupW(inInfoW->Comment);
} }
else else
{ {
info->Name = SECUR32_AllocWideFromMultiByte(inInfoA->Name); info->Name = strdupAW(inInfoA->Name);
info->Comment = SECUR32_AllocWideFromMultiByte(inInfoA->Comment); info->Comment = strdupAW(inInfoA->Comment);
} }
} }
} }
...@@ -400,8 +365,7 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, ...@@ -400,8 +365,7 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
if (!providerTable) if (!providerTable)
{ {
providerTable = heap_alloc(sizeof(SecureProviderTable)); if (!(providerTable = malloc(sizeof(*ret))))
if (!providerTable)
{ {
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
return NULL; return NULL;
...@@ -410,8 +374,7 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, ...@@ -410,8 +374,7 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
list_init(&providerTable->table); list_init(&providerTable->table);
} }
ret = heap_alloc(sizeof(SecureProvider)); if (!(ret = malloc(sizeof(*ret))))
if (!ret)
{ {
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
return NULL; return NULL;
...@@ -422,17 +385,17 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, ...@@ -422,17 +385,17 @@ SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
if (fnTableA || fnTableW) if (fnTableA || fnTableW)
{ {
ret->moduleName = moduleName ? SECUR32_strdupW(moduleName) : NULL; ret->moduleName = moduleName ? strdupW(moduleName) : NULL;
_makeFnTableA(&ret->fnTableA, fnTableA, fnTableW); _makeFnTableA(&ret->fnTableA, fnTableA, fnTableW);
_makeFnTableW(&ret->fnTableW, fnTableA, fnTableW); _makeFnTableW(&ret->fnTableW, fnTableA, fnTableW);
ret->loaded = !moduleName; ret->loaded = !moduleName;
} }
else else
{ {
ret->moduleName = SECUR32_strdupW(moduleName); ret->moduleName = strdupW(moduleName);
ret->loaded = FALSE; ret->loaded = FALSE;
} }
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
return ret; return ret;
} }
...@@ -449,8 +412,7 @@ void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd, ...@@ -449,8 +412,7 @@ void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
if (!packageTable) if (!packageTable)
{ {
packageTable = heap_alloc(sizeof(SecurePackageTable)); if (!(packageTable = malloc(sizeof(*packageTable))))
if (!packageTable)
{ {
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
return; return;
...@@ -459,19 +421,17 @@ void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd, ...@@ -459,19 +421,17 @@ void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
packageTable->numPackages = 0; packageTable->numPackages = 0;
list_init(&packageTable->table); list_init(&packageTable->table);
} }
for (i = 0; i < toAdd; i++) for (i = 0; i < toAdd; i++)
{ {
SecurePackage *package = heap_alloc(sizeof(SecurePackage)); SecurePackage *package;
if (!package)
continue; if (!(package = malloc(sizeof(*package)))) continue;
list_add_tail(&packageTable->table, &package->entry); list_add_tail(&packageTable->table, &package->entry);
package->provider = provider; package->provider = provider;
_copyPackageInfo(&package->infoW, _copyPackageInfo(&package->infoW, infoA ? &infoA[i] : NULL, infoW ? &infoW[i] : NULL);
infoA ? &infoA[i] : NULL,
infoW ? &infoW[i] : NULL);
} }
packageTable->numPackages += toAdd; packageTable->numPackages += toAdd;
...@@ -599,14 +559,11 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName) ...@@ -599,14 +559,11 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName)
LIST_FOR_EACH_ENTRY(ret, &packageTable->table, SecurePackage, entry) LIST_FOR_EACH_ENTRY(ret, &packageTable->table, SecurePackage, entry)
{ {
matched = !lstrcmpiW(ret->infoW.Name, packageName); matched = !lstrcmpiW(ret->infoW.Name, packageName);
if (matched) if (matched) break;
break;
} }
if (!matched) return NULL;
if (!matched)
return NULL;
if (ret->provider && !ret->provider->loaded) if (ret->provider && !ret->provider->loaded)
{ {
ret->provider->lib = LoadLibraryW(ret->provider->moduleName); ret->provider->lib = LoadLibraryW(ret->provider->moduleName);
if (ret->provider->lib) if (ret->provider->lib)
...@@ -668,28 +625,26 @@ static void SECUR32_freeProviders(void) ...@@ -668,28 +625,26 @@ static void SECUR32_freeProviders(void)
LIST_FOR_EACH_ENTRY_SAFE(package, package_next, &packageTable->table, LIST_FOR_EACH_ENTRY_SAFE(package, package_next, &packageTable->table,
SecurePackage, entry) SecurePackage, entry)
{ {
heap_free(package->infoW.Name); free(package->infoW.Name);
heap_free(package->infoW.Comment); free(package->infoW.Comment);
heap_free(package); free(package);
} }
heap_free(packageTable); free(packageTable);
packageTable = NULL; packageTable = NULL;
} }
if (providerTable) if (providerTable)
{ {
SecureProvider *provider, *provider_next; SecureProvider *provider, *provider_next;
LIST_FOR_EACH_ENTRY_SAFE(provider, provider_next, &providerTable->table, LIST_FOR_EACH_ENTRY_SAFE(provider, provider_next, &providerTable->table, SecureProvider, entry)
SecureProvider, entry)
{ {
heap_free(provider->moduleName); free(provider->moduleName);
if (provider->lib) if (provider->lib) FreeLibrary(provider->lib);
FreeLibrary(provider->lib); free(provider);
heap_free(provider);
} }
heap_free(providerTable); free(providerTable);
providerTable = NULL; providerTable = NULL;
} }
...@@ -704,9 +659,9 @@ static void SECUR32_freeProviders(void) ...@@ -704,9 +659,9 @@ static void SECUR32_freeProviders(void)
* The sample ssp seems to use LocalAlloc/LocalFee, but there doesn't seem to * The sample ssp seems to use LocalAlloc/LocalFee, but there doesn't seem to
* be any guarantee, nor is there an alloc function in secur32. * be any guarantee, nor is there an alloc function in secur32.
*/ */
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv) SECURITY_STATUS WINAPI FreeContextBuffer( void *pv )
{ {
heap_free(pv); RtlFreeHeap( GetProcessHeap(), 0, pv );
return SEC_E_OK; return SEC_E_OK;
} }
...@@ -738,8 +693,8 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, ...@@ -738,8 +693,8 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages,
} }
if (bytesNeeded) if (bytesNeeded)
{ {
*ppPackageInfo = heap_alloc(bytesNeeded); /* freed with FeeContextBuffer */
if (*ppPackageInfo) if ((*ppPackageInfo = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
{ {
ULONG i = 0; ULONG i = 0;
PWSTR nextString; PWSTR nextString;
...@@ -803,8 +758,8 @@ static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages, ...@@ -803,8 +758,8 @@ static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages,
bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment, bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment,
-1, NULL, 0, NULL, NULL); -1, NULL, 0, NULL, NULL);
} }
ret = heap_alloc(bytesNeeded); /* freed with FreeContextBuffer */
if (ret) if ((ret = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
{ {
PSTR nextString; PSTR nextString;
...@@ -895,7 +850,7 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(PULONG pcPackages, ...@@ -895,7 +850,7 @@ SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(PULONG pcPackages,
* nSize returns the number of characters written when lpNameBuffer is not * nSize returns the number of characters written when lpNameBuffer is not
* NULL or the size of the buffer needed to hold the name when the buffer * NULL or the size of the buffer needed to hold the name when the buffer
* is too short or lpNameBuffer is NULL. * is too short or lpNameBuffer is NULL.
* *
* It the buffer is too short, ERROR_INSUFFICIENT_BUFFER error will be set. * It the buffer is too short, ERROR_INSUFFICIENT_BUFFER error will be set.
*/ */
BOOLEAN WINAPI GetComputerObjectNameA( BOOLEAN WINAPI GetComputerObjectNameA(
...@@ -908,8 +863,7 @@ BOOLEAN WINAPI GetComputerObjectNameA( ...@@ -908,8 +863,7 @@ BOOLEAN WINAPI GetComputerObjectNameA(
TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
if (lpNameBuffer) { if (lpNameBuffer) {
bufferW = heap_alloc(sizeW * sizeof(WCHAR)); if (!(bufferW = malloc(sizeW * sizeof(WCHAR)))) {
if (bufferW == NULL) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE; return FALSE;
} }
...@@ -922,7 +876,7 @@ BOOLEAN WINAPI GetComputerObjectNameA( ...@@ -922,7 +876,7 @@ BOOLEAN WINAPI GetComputerObjectNameA(
} }
else else
*nSize = sizeW; *nSize = sizeW;
heap_free(bufferW); free(bufferW);
return rc; return rc;
} }
...@@ -1115,7 +1069,7 @@ BOOLEAN WINAPI GetUserNameExA( ...@@ -1115,7 +1069,7 @@ BOOLEAN WINAPI GetUserNameExA(
ULONG sizeW = *nSize; ULONG sizeW = *nSize;
TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
if (lpNameBuffer) { if (lpNameBuffer) {
bufferW = heap_alloc(sizeW * sizeof(WCHAR)); bufferW = malloc(sizeW * sizeof(WCHAR));
if (bufferW == NULL) { if (bufferW == NULL) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE; return FALSE;
...@@ -1138,7 +1092,7 @@ BOOLEAN WINAPI GetUserNameExA( ...@@ -1138,7 +1092,7 @@ BOOLEAN WINAPI GetUserNameExA(
} }
else else
*nSize = sizeW; *nSize = sizeW;
heap_free(bufferW); free(bufferW);
return rc; return rc;
} }
......
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <limits.h> #include <limits.h>
#include "wine/heap.h"
#include "wine/list.h"
#include "schannel.h" #include "schannel.h"
#include "wine/list.h"
extern HINSTANCE hsecur32 DECLSPEC_HIDDEN; extern HINSTANCE hsecur32 DECLSPEC_HIDDEN;
...@@ -71,11 +70,6 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName) DECLSPEC_HIDDEN; ...@@ -71,11 +70,6 @@ SecurePackage *SECUR32_findPackageW(PCWSTR packageName) DECLSPEC_HIDDEN;
*/ */
SecurePackage *SECUR32_findPackageA(PCSTR packageName) DECLSPEC_HIDDEN; SecurePackage *SECUR32_findPackageA(PCSTR packageName) DECLSPEC_HIDDEN;
/* A few string helpers; will return NULL if str is NULL. Free return with
* HeapFree */
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str) DECLSPEC_HIDDEN;
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str) DECLSPEC_HIDDEN;
/* Initialization functions for built-in providers */ /* Initialization functions for built-in providers */
void SECUR32_initSchannelSP(void) DECLSPEC_HIDDEN; void SECUR32_initSchannelSP(void) DECLSPEC_HIDDEN;
void SECUR32_initNegotiateSP(void) DECLSPEC_HIDDEN; void SECUR32_initNegotiateSP(void) DECLSPEC_HIDDEN;
......
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h"
#include "winnls.h" #include "winnls.h"
#include "sspi.h" #include "sspi.h"
...@@ -32,8 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(secur32); ...@@ -32,8 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(secur32);
* phSec->dwUpper) and a copy of realHandle (stored in phSec->dwLower). * phSec->dwUpper) and a copy of realHandle (stored in phSec->dwLower).
* SecHandle is equivalent to both a CredHandle and a CtxtHandle. * SecHandle is equivalent to both a CredHandle and a CtxtHandle.
*/ */
static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec, static SECURITY_STATUS make_sec_handle(PSecHandle phSec, SecurePackage *package, PSecHandle realHandle)
SecurePackage *package, PSecHandle realHandle)
{ {
SECURITY_STATUS ret; SECURITY_STATUS ret;
...@@ -41,8 +42,7 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec, ...@@ -41,8 +42,7 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec,
if (phSec && package && realHandle) if (phSec && package && realHandle)
{ {
PSecHandle newSec = heap_alloc(sizeof(SecHandle)); PSecHandle newSec = malloc(sizeof(*newSec));
if (newSec) if (newSec)
{ {
*newSec = *realHandle; *newSec = *realHandle;
...@@ -87,7 +87,7 @@ SECURITY_STATUS WINAPI AcquireCredentialsHandleA( ...@@ -87,7 +87,7 @@ SECURITY_STATUS WINAPI AcquireCredentialsHandleA(
ptsExpiry); ptsExpiry);
if (ret == SEC_E_OK) if (ret == SEC_E_OK)
{ {
ret = SECUR32_makeSecHandle(phCredential, package, &myCred); ret = make_sec_handle(phCredential, package, &myCred);
if (ret != SEC_E_OK) if (ret != SEC_E_OK)
package->provider->fnTableW.FreeCredentialsHandle( package->provider->fnTableW.FreeCredentialsHandle(
&myCred); &myCred);
...@@ -133,7 +133,7 @@ SECURITY_STATUS WINAPI AcquireCredentialsHandleW( ...@@ -133,7 +133,7 @@ SECURITY_STATUS WINAPI AcquireCredentialsHandleW(
ptsExpiry); ptsExpiry);
if (ret == SEC_E_OK) if (ret == SEC_E_OK)
{ {
ret = SECUR32_makeSecHandle(phCredential, package, &myCred); ret = make_sec_handle(phCredential, package, &myCred);
if (ret != SEC_E_OK) if (ret != SEC_E_OK)
package->provider->fnTableW.FreeCredentialsHandle( package->provider->fnTableW.FreeCredentialsHandle(
&myCred); &myCred);
...@@ -169,7 +169,7 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle( ...@@ -169,7 +169,7 @@ SECURITY_STATUS WINAPI FreeCredentialsHandle(
ret = package->provider->fnTableW.FreeCredentialsHandle(cred); ret = package->provider->fnTableW.FreeCredentialsHandle(cred);
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
heap_free(cred); free(cred);
} }
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
...@@ -287,7 +287,7 @@ SECURITY_STATUS WINAPI InitializeSecurityContextA( ...@@ -287,7 +287,7 @@ SECURITY_STATUS WINAPI InitializeSecurityContextA(
phNewContext && phNewContext != phContext) phNewContext && phNewContext != phContext)
{ {
SECURITY_STATUS ret2; SECURITY_STATUS ret2;
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt); ret2 = make_sec_handle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK) if (ret2 != SEC_E_OK)
package->provider->fnTableA.DeleteSecurityContext(&myCtxt); package->provider->fnTableA.DeleteSecurityContext(&myCtxt);
} }
...@@ -351,7 +351,7 @@ SECURITY_STATUS WINAPI InitializeSecurityContextW( ...@@ -351,7 +351,7 @@ SECURITY_STATUS WINAPI InitializeSecurityContextW(
phNewContext && phNewContext != phContext) phNewContext && phNewContext != phContext)
{ {
SECURITY_STATUS ret2; SECURITY_STATUS ret2;
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt); ret2 = make_sec_handle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK) if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(&myCtxt); package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
} }
...@@ -395,7 +395,7 @@ SECURITY_STATUS WINAPI AcceptSecurityContext( ...@@ -395,7 +395,7 @@ SECURITY_STATUS WINAPI AcceptSecurityContext(
myCtxt.dwUpper = realCtxt->dwUpper; myCtxt.dwUpper = realCtxt->dwUpper;
myCtxt.dwLower = realCtxt->dwLower; myCtxt.dwLower = realCtxt->dwLower;
} }
ret = package->provider->fnTableW.AcceptSecurityContext( ret = package->provider->fnTableW.AcceptSecurityContext(
cred, phContext ? &myCtxt : NULL, pInput, fContextReq, cred, phContext ? &myCtxt : NULL, pInput, fContextReq,
TargetDataRep, &myCtxt, pOutput, pfContextAttr, ptsExpiry); TargetDataRep, &myCtxt, pOutput, pfContextAttr, ptsExpiry);
...@@ -403,7 +403,7 @@ SECURITY_STATUS WINAPI AcceptSecurityContext( ...@@ -403,7 +403,7 @@ SECURITY_STATUS WINAPI AcceptSecurityContext(
phNewContext && phNewContext != phContext) phNewContext && phNewContext != phContext)
{ {
SECURITY_STATUS ret2; SECURITY_STATUS ret2;
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt); ret2 = make_sec_handle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK) if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext( package->provider->fnTableW.DeleteSecurityContext(
&myCtxt); &myCtxt);
...@@ -468,7 +468,7 @@ SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext) ...@@ -468,7 +468,7 @@ SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
ret = package->provider->fnTableW.DeleteSecurityContext(ctxt); ret = package->provider->fnTableW.DeleteSecurityContext(ctxt);
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
heap_free(ctxt); free(ctxt);
} }
else else
ret = SEC_E_INVALID_HANDLE; ret = SEC_E_INVALID_HANDLE;
...@@ -690,7 +690,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName, ...@@ -690,7 +690,7 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,
PSecPkgInfoA *ppPackageInfo) PSecPkgInfoA *ppPackageInfo)
{ {
SECURITY_STATUS ret; SECURITY_STATUS ret;
TRACE("%s %p\n", debugstr_a(pszPackageName), ppPackageInfo); TRACE("%s %p\n", debugstr_a(pszPackageName), ppPackageInfo);
if (pszPackageName) if (pszPackageName)
{ {
...@@ -713,8 +713,8 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName, ...@@ -713,8 +713,8 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,
package->infoW.Comment, -1, NULL, 0, NULL, NULL); package->infoW.Comment, -1, NULL, 0, NULL, NULL);
bytesNeeded += commentLen; bytesNeeded += commentLen;
} }
*ppPackageInfo = heap_alloc(bytesNeeded); /* freed with FreeContextBuffer */
if (*ppPackageInfo) if ((*ppPackageInfo = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
{ {
PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo + PSTR nextString = (PSTR)((PBYTE)*ppPackageInfo +
sizeof(SecPkgInfoA)); sizeof(SecPkgInfoA));
...@@ -775,8 +775,8 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName, ...@@ -775,8 +775,8 @@ SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName,
commentLen = lstrlenW(package->infoW.Comment) + 1; commentLen = lstrlenW(package->infoW.Comment) + 1;
bytesNeeded += commentLen * sizeof(WCHAR); bytesNeeded += commentLen * sizeof(WCHAR);
} }
*ppPackageInfo = heap_alloc(bytesNeeded); /* freed with FreeContextBuffer */
if (*ppPackageInfo) if ((*ppPackageInfo = RtlAllocateHeap(GetProcessHeap(), 0, bytesNeeded)))
{ {
PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo + PWSTR nextString = (PWSTR)((PBYTE)*ppPackageInfo +
sizeof(SecPkgInfoW)); sizeof(SecPkgInfoW));
...@@ -845,7 +845,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage, ...@@ -845,7 +845,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage,
{ {
SECURITY_STATUS ret; SECURITY_STATUS ret;
SecurePackage *package = SECUR32_findPackageA(pszPackage); SecurePackage *package = SECUR32_findPackageA(pszPackage);
TRACE("%s %p %p %p\n", debugstr_a(pszPackage), pPackedContext, Token, TRACE("%s %p %p %p\n", debugstr_a(pszPackage), pPackedContext, Token,
phContext); phContext);
if (package && package->provider) if (package && package->provider)
...@@ -858,7 +858,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage, ...@@ -858,7 +858,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage,
pszPackage, pPackedContext, Token, &myCtxt); pszPackage, pPackedContext, Token, &myCtxt);
if (ret == SEC_E_OK) if (ret == SEC_E_OK)
{ {
ret = SECUR32_makeSecHandle(phContext, package, &myCtxt); ret = make_sec_handle(phContext, package, &myCtxt);
if (ret != SEC_E_OK) if (ret != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(&myCtxt); package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
} }
...@@ -893,7 +893,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextW(SEC_WCHAR *pszPackage, ...@@ -893,7 +893,7 @@ SECURITY_STATUS WINAPI ImportSecurityContextW(SEC_WCHAR *pszPackage,
pszPackage, pPackedContext, Token, &myCtxt); pszPackage, pPackedContext, Token, &myCtxt);
if (ret == SEC_E_OK) if (ret == SEC_E_OK)
{ {
ret = SECUR32_makeSecHandle(phContext, package, &myCtxt); ret = make_sec_handle(phContext, package, &myCtxt);
if (ret != SEC_E_OK) if (ret != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(&myCtxt); package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment