Henri Verbeet : secur32: Improve error handling for gnutls_certificate_allocate_credentials().
Alexandre Julliard
julliard at winehq.org
Tue Oct 7 08:53:58 CDT 2008
Module: wine
Branch: master
Commit: 937488c298e4a5ec8d0c4221fd751cd9cb47ddf4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=937488c298e4a5ec8d0c4221fd751cd9cb47ddf4
Author: Henri Verbeet <hverbeet at gmail.com>
Date: Mon Oct 6 19:08:47 2008 +0200
secur32: Improve error handling for gnutls_certificate_allocate_credentials().
---
dlls/secur32/schannel.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index f501bab..9d64799 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -46,6 +46,7 @@ MAKE_FUNCPTR(gnutls_global_deinit);
MAKE_FUNCPTR(gnutls_global_init);
MAKE_FUNCPTR(gnutls_global_set_log_function);
MAKE_FUNCPTR(gnutls_global_set_log_level);
+MAKE_FUNCPTR(gnutls_perror);
#undef MAKE_FUNCPTR
#define SCHAN_INVALID_HANDLE ~0UL
@@ -262,6 +263,7 @@ static SECURITY_STATUS schan_CheckCreds(const SCHANNEL_CRED *schanCred)
static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schanCred,
PCredHandle phCredential, PTimeStamp ptsExpiry)
{
+ struct schan_credentials *creds;
SECURITY_STATUS st = SEC_E_OK;
TRACE("schanCred %p, phCredential %p, ptsExpiry %p\n", schanCred, phCredential, ptsExpiry);
@@ -279,20 +281,21 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan
if (st == SEC_E_OK)
{
ULONG_PTR handle;
- struct schan_credentials *creds;
+ int ret;
creds = HeapAlloc(GetProcessHeap(), 0, sizeof(*creds));
if (!creds) return SEC_E_INSUFFICIENT_MEMORY;
handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
- if (handle == SCHAN_INVALID_HANDLE)
- {
- HeapFree(GetProcessHeap(), 0, creds);
- return SEC_E_INTERNAL_ERROR;
- }
+ if (handle == SCHAN_INVALID_HANDLE) goto fail;
creds->credential_use = SECPKG_CRED_OUTBOUND;
- pgnutls_certificate_allocate_credentials(&creds->credentials);
+ ret = pgnutls_certificate_allocate_credentials(&creds->credentials);
+ if (ret != GNUTLS_E_SUCCESS)
+ {
+ pgnutls_perror(ret);
+ goto fail;
+ }
phCredential->dwLower = handle;
phCredential->dwUpper = 0;
@@ -305,6 +308,10 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan
}
}
return st;
+
+fail:
+ HeapFree(GetProcessHeap(), 0, creds);
+ return SEC_E_INTERNAL_ERROR;
}
static SECURITY_STATUS schan_AcquireServerCredentials(const SCHANNEL_CRED *schanCred,
@@ -548,6 +555,7 @@ void SECUR32_initSchannelSP(void)
LOAD_FUNCPTR(gnutls_global_init)
LOAD_FUNCPTR(gnutls_global_set_log_function)
LOAD_FUNCPTR(gnutls_global_set_log_level)
+ LOAD_FUNCPTR(gnutls_perror)
#undef LOAD_FUNCPTR
provider = SECUR32_addProvider(&schanTableA, &schanTableW, schannelDllName);
More information about the wine-cvs
mailing list