Hans Leidekker : secur32: Implement QueryContextAttributesA( SECPKG_ATTR_NEGOTIATION_INFO) in the LSA wrapper.
Alexandre Julliard
julliard at winehq.org
Thu Feb 8 15:33:08 CST 2018
Module: wine
Branch: master
Commit: 3e4fb94d82530580bb7db42b2ce99965d7f38861
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3e4fb94d82530580bb7db42b2ce99965d7f38861
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Feb 8 11:54:00 2018 +0100
secur32: Implement QueryContextAttributesA(SECPKG_ATTR_NEGOTIATION_INFO) in the LSA wrapper.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/secur32/lsa.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/secur32/lsa.c b/dlls/secur32/lsa.c
index 511e24a..b93006a 100644
--- a/dlls/secur32/lsa.c
+++ b/dlls/secur32/lsa.c
@@ -554,6 +554,32 @@ static SECURITY_STATUS WINAPI lsa_QueryContextAttributesW(CtxtHandle *context, U
return lsa_package->lsa_api->SpQueryContextAttributes(lsa_context, attribute, buffer);
}
+static SecPkgInfoA *package_infoWtoA( const SecPkgInfoW *info )
+{
+ SecPkgInfoA *ret;
+ 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 );
+
+ if (!(ret = HeapAlloc( GetProcessHeap(), 0, sizeof(*ret) + size_name + size_comment ))) return NULL;
+ ret->fCapabilities = info->fCapabilities;
+ ret->wVersion = info->wVersion;
+ ret->wRPCID = info->wRPCID;
+ ret->cbMaxToken = info->cbMaxToken;
+ ret->Name = (SEC_CHAR *)(ret + 1);
+ WideCharToMultiByte( CP_ACP, 0, info->Name, -1, ret->Name, size_name, NULL, NULL );
+ ret->Comment = ret->Name + size_name;
+ WideCharToMultiByte( CP_ACP, 0, info->Comment, -1, ret->Comment, size_comment, NULL, NULL );
+ return ret;
+}
+
+static SECURITY_STATUS nego_info_WtoA( const SecPkgContext_NegotiationInfoW *infoW,
+ SecPkgContext_NegotiationInfoA *infoA )
+{
+ infoA->NegotiationState = infoW->NegotiationState;
+ if (!(infoA->PackageInfo = package_infoWtoA( infoW->PackageInfo ))) return SEC_E_INSUFFICIENT_MEMORY;
+ return SEC_E_OK;
+}
+
static SECURITY_STATUS WINAPI lsa_QueryContextAttributesA(CtxtHandle *context, ULONG attribute, void *buffer)
{
TRACE("%p %d %p\n", context, attribute, buffer);
@@ -565,6 +591,18 @@ static SECURITY_STATUS WINAPI lsa_QueryContextAttributesA(CtxtHandle *context, U
case SECPKG_ATTR_SIZES:
return lsa_QueryContextAttributesW( context, attribute, buffer );
+ case SECPKG_ATTR_NEGOTIATION_INFO:
+ {
+ SecPkgContext_NegotiationInfoW infoW;
+ SecPkgContext_NegotiationInfoA *infoA = (SecPkgContext_NegotiationInfoA *)buffer;
+ SECURITY_STATUS status = lsa_QueryContextAttributesW( context, SECPKG_ATTR_NEGOTIATION_INFO, &infoW );
+
+ if (status != SEC_E_OK) return status;
+ status = nego_info_WtoA( &infoW, infoA );
+ FreeContextBuffer( infoW.PackageInfo );
+ return status;
+ }
+
#define X(x) case (x) : FIXME(#x" stub\n"); break
X(SECPKG_ATTR_ACCESS_TOKEN);
X(SECPKG_ATTR_AUTHORITY);
@@ -578,7 +616,6 @@ static SECURITY_STATUS WINAPI lsa_QueryContextAttributesA(CtxtHandle *context, U
X(SECPKG_ATTR_SESSION_KEY);
X(SECPKG_ATTR_STREAM_SIZES);
X(SECPKG_ATTR_TARGET_INFORMATION);
- X(SECPKG_ATTR_NEGOTIATION_INFO);
#undef X
default:
FIXME( "unknown attribute %u\n", attribute );
More information about the wine-cvs
mailing list