From de853f33be96a250899e30b92c65d32c043541b7 Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Thu, 25 Nov 2021 21:23:15 -0800 Subject: [PATCH] Increase Sspi#MAX_TOKEN_SIZE on Windows 8/Server 2012 and later --- CHANGES.md | 1 + .../src/com/sun/jna/platform/win32/Sspi.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 79141e665e..da90f03d55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Next Release (5.11.0) Features -------- +* [#1398](https://github.com/java-native-access/jna/pull/1398): Increase `c.s.j.p.win32.Sspi#MAX_TOKEN_SIZE` on Windows 8/Server 2012 and later - [@dbwiddis](https://github.com/dbwiddis). Bug Fixes --------- diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Sspi.java b/contrib/platform/src/com/sun/jna/platform/win32/Sspi.java index c77410128f..d2859dafc2 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/Sspi.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Sspi.java @@ -37,9 +37,19 @@ public interface Sspi { /** - * Maximum size in bytes of a security token. + * Maximum size in bytes of a security token. {@code MAX_TOKEN_SIZE} has the + * following default value, depending on the version of Windows that builds the + * token: + *

+ * Windows Server 2008 R2 and earlier versions, and Windows 7 and earlier + * versions: 12,000 bytes. Windows Server 2012 and later versions, and Windows 8 + * and later versions: 48,000 bytes + * + * @see Problems + * with Kerberos authentication when a user belongs to many groups */ - int MAX_TOKEN_SIZE = 12288; + int MAX_TOKEN_SIZE = VersionHelpers.IsWindows8OrGreater() ? 48000 : 12000; // Flags for the fCredentialUse parameter of AcquireCredentialsHandle