Ken Thomases : secur32: Extract schan_imp_create/dispose_session functions.
Alexandre Julliard
julliard at winehq.org
Mon Mar 14 14:29:44 CDT 2011
Module: wine
Branch: master
Commit: aeefb8188d3283b49329689c5c9083f7fb8a4c47
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aeefb8188d3283b49329689c5c9083f7fb8a4c47
Author: Ken Thomases <ken at codeweavers.com>
Date: Sun Mar 13 18:57:57 2011 -0500
secur32: Extract schan_imp_create/dispose_session functions.
---
dlls/secur32/schannel.c | 48 ++++++++++++++++++++++++++++++----------------
1 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 794f36b..d97d2f6 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -75,6 +75,33 @@ MAKE_FUNCPTR(gnutls_transport_set_push_function);
struct schan_transport;
+static BOOL schan_imp_create_session(gnutls_session_t *s, BOOL is_server)
+{
+ int err = pgnutls_init(s, is_server ? GNUTLS_SERVER : GNUTLS_CLIENT);
+ if (err != GNUTLS_E_SUCCESS)
+ {
+ pgnutls_perror(err);
+ return FALSE;
+ }
+
+ /* FIXME: We should be using the information from the credentials here. */
+ FIXME("Using hardcoded \"NORMAL\" priority\n");
+ err = pgnutls_set_default_priority(*s);
+ if (err != GNUTLS_E_SUCCESS)
+ {
+ pgnutls_perror(err);
+ pgnutls_deinit(*s);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void schan_imp_dispose_session(gnutls_session_t s)
+{
+ pgnutls_deinit(s);
+}
+
static void schan_imp_set_session_transport(gnutls_session_t s,
struct schan_transport *t)
{
@@ -939,31 +966,18 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
return SEC_E_INTERNAL_ERROR;
}
- err = pgnutls_init(&ctx->session, GNUTLS_CLIENT);
- if (err != GNUTLS_E_SUCCESS)
+ if (!schan_imp_create_session(&ctx->session, FALSE))
{
- pgnutls_perror(err);
schan_free_handle(handle, SCHAN_HANDLE_CTX);
HeapFree(GetProcessHeap(), 0, ctx);
return SEC_E_INTERNAL_ERROR;
}
- /* FIXME: We should be using the information from the credentials here. */
- FIXME("Using hardcoded \"NORMAL\" priority\n");
- err = pgnutls_set_default_priority(ctx->session);
- if (err != GNUTLS_E_SUCCESS)
- {
- pgnutls_perror(err);
- pgnutls_deinit(ctx->session);
- schan_free_handle(handle, SCHAN_HANDLE_CTX);
- HeapFree(GetProcessHeap(), 0, ctx);
- }
-
err = pgnutls_credentials_set(ctx->session, GNUTLS_CRD_CERTIFICATE, cred->credentials);
if (err != GNUTLS_E_SUCCESS)
{
pgnutls_perror(err);
- pgnutls_deinit(ctx->session);
+ schan_imp_dispose_session(ctx->session);
schan_free_handle(handle, SCHAN_HANDLE_CTX);
HeapFree(GetProcessHeap(), 0, ctx);
}
@@ -1401,7 +1415,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DeleteSecurityContext(PCtxtHandle context
ctx = schan_free_handle(context_handle->dwLower, SCHAN_HANDLE_CTX);
if (!ctx) return SEC_E_INVALID_HANDLE;
- pgnutls_deinit(ctx->session);
+ schan_imp_dispose_session(ctx->session);
HeapFree(GetProcessHeap(), 0, ctx);
return SEC_E_OK;
@@ -1601,7 +1615,7 @@ void SECUR32_deinitSchannelSP(void)
if (schan_handle_table[i].type == SCHAN_HANDLE_CTX)
{
struct schan_context *ctx = schan_free_handle(i, SCHAN_HANDLE_CTX);
- pgnutls_deinit(ctx->session);
+ schan_imp_dispose_session(ctx->session);
HeapFree(GetProcessHeap(), 0, ctx);
}
}
More information about the wine-cvs
mailing list