[HTTPCLIENT-1947] Update JNA from 4.5.2 to 5.0.0.

This commit is contained in:
Gary Gregory 2018-10-22 13:08:58 -06:00
parent 75ca519314
commit 369592d333
3 changed files with 9 additions and 5 deletions

View File

@ -16,6 +16,9 @@ Changelog:
* HTTPCLIENT-1939: Update Apache Commons Codec from 1.10 to 1.11 * HTTPCLIENT-1939: Update Apache Commons Codec from 1.10 to 1.11
Contributed by Gary Gregory <ggregory at apache.org> Contributed by Gary Gregory <ggregory at apache.org>
* HTTPCLIENT-1947: Update JNA from 4.5.2 to 5.0.0
Contributed by Gary Gregory <ggregory at apache.org>
Release 5.0-BETA1 Release 5.0-BETA1
------------------- -------------------

View File

@ -55,6 +55,7 @@ import com.sun.jna.platform.win32.Sspi.CredHandle;
import com.sun.jna.platform.win32.Sspi.CtxtHandle; import com.sun.jna.platform.win32.Sspi.CtxtHandle;
import com.sun.jna.platform.win32.Sspi.SecBufferDesc; import com.sun.jna.platform.win32.Sspi.SecBufferDesc;
import com.sun.jna.platform.win32.Sspi.TimeStamp; import com.sun.jna.platform.win32.Sspi.TimeStamp;
import com.sun.jna.platform.win32.SspiUtil.ManagedSecBufferDesc;
import com.sun.jna.platform.win32.Win32Exception; import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinError; import com.sun.jna.platform.win32.WinError;
import com.sun.jna.ptr.IntByReference; import com.sun.jna.ptr.IntByReference;
@ -207,8 +208,8 @@ public class WindowsNegotiateScheme implements AuthScheme {
} else { } else {
try { try {
final byte[] continueTokenBytes = Base64.decodeBase64(challenge); final byte[] continueTokenBytes = Base64.decodeBase64(challenge);
final SecBufferDesc continueTokenBuffer = new SecBufferDesc( final SecBufferDesc continueTokenBuffer = new ManagedSecBufferDesc(
Sspi.SECBUFFER_TOKEN, continueTokenBytes); Sspi.SECBUFFER_TOKEN, continueTokenBytes);
final String targetName = getServicePrincipalName(request, clientContext); final String targetName = getServicePrincipalName(request, clientContext);
response = getToken(this.sspiContext, continueTokenBuffer, targetName); response = getToken(this.sspiContext, continueTokenBuffer, targetName);
} catch (final RuntimeException ex) { } catch (final RuntimeException ex) {
@ -270,7 +271,7 @@ public class WindowsNegotiateScheme implements AuthScheme {
final SecBufferDesc continueToken, final SecBufferDesc continueToken,
final String targetName) { final String targetName) {
final IntByReference attr = new IntByReference(); final IntByReference attr = new IntByReference();
final SecBufferDesc token = new SecBufferDesc( final ManagedSecBufferDesc token = new ManagedSecBufferDesc(
Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE); Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
sspiContext = new CtxtHandle(); sspiContext = new CtxtHandle();
@ -290,7 +291,7 @@ public class WindowsNegotiateScheme implements AuthScheme {
dispose(); dispose();
throw new Win32Exception(rc); throw new Win32Exception(rc);
} }
return Base64.encodeBase64String(token.getBytes()); return Base64.encodeBase64String(token.getBuffer(0).getBytes());
} }
@Override @Override

View File

@ -77,7 +77,7 @@
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<easymock.version>3.2</easymock.version> <easymock.version>3.2</easymock.version>
<mockito.version>2.21.0</mockito.version> <mockito.version>2.21.0</mockito.version>
<jna.version>4.5.2</jna.version> <jna.version>5.0.0</jna.version>
<hc.stylecheck.version>1</hc.stylecheck.version> <hc.stylecheck.version>1</hc.stylecheck.version>
<rxjava.version>2.2.2</rxjava.version> <rxjava.version>2.2.2</rxjava.version>
</properties> </properties>