mariadb-java-client/remove_waffle-jna.patch
2016-09-14 12:49:59 +02:00

54 lines
2.3 KiB
Diff

--- mariadb-connector-j-1.5.2/src/main/java/org/mariadb/jdbc/internal/packet/send/SendGssApiAuthPacket.java 2016-08-31 01:52:20.000000000 +0200
+++ SendGssApiAuthPacket.java 2016-09-14 12:12:17.784284202 +0200
@@ -55,7 +55,6 @@
import org.mariadb.jdbc.internal.packet.result.ErrorPacket;
import org.mariadb.jdbc.internal.packet.send.gssapi.GssapiAuth;
import org.mariadb.jdbc.internal.packet.send.gssapi.StandardGssapiAuthentication;
-import org.mariadb.jdbc.internal.packet.send.gssapi.WindowsNativeSspiAuthentication;
import org.mariadb.jdbc.internal.stream.PacketOutputStream;
import org.mariadb.jdbc.internal.util.buffer.Buffer;
import org.mariadb.jdbc.internal.util.dao.QueryException;
@@ -85,7 +84,7 @@
String mechanisms = buffer.readString(Charset.forName("UTF-8"));
if (mechanisms.equals("")) mechanisms = "Kerberos";
- GssapiAuth gssapiAuth = getAuthenticationMethod();
+ GssapiAuth gssapiAuth = new StandardGssapiAuthentication(packetFetcher, packSeq);
gssapiAuth.authenticate(writer, serverPrincipalName, mechanisms);
}
@@ -103,33 +102,5 @@
throw new QueryException("Authentication exception", 1045, "28000", e);
}
}
-
- /**
- * Get authentication method according to classpath.
- * Windows native authentication is using Waffle-jna.
- *
- * @return authentication method
- */
- private GssapiAuth getAuthenticationMethod() {
- try {
- //Waffle-jna has jna as dependency, so if not available on classpath, just use standard authentication
- Class platformClass = Class.forName("com.sun.jna.Platform");
- @SuppressWarnings("unchecked")
- Method method = platformClass.getMethod("isWindows");
- Boolean isWindows = (Boolean) method.invoke(platformClass);
- if (isWindows.booleanValue()) {
- try {
- Class.forName("waffle.windows.auth.impl.WindowsAuthProviderImpl");
- return new WindowsNativeSspiAuthentication(packetFetcher, packSeq);
- } catch (ClassNotFoundException cle) {
- //waffle not in the classpath
- }
- }
- } catch (Exception cle) {
- //jna jar's are not in classpath
- }
- return new StandardGssapiAuthentication(packetFetcher, packSeq);
- }
-
}