File: java9.patch

package info (click to toggle)
libjtds-java 1.2.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,232 kB
  • sloc: java: 39,523; xml: 702; sh: 34; makefile: 12
file content (239 lines) | stat: -rw-r--r-- 9,345 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
From: Markus Koschany <apo@debian.org>
Date: Sat, 23 Dec 2017 00:32:22 +0100
Subject: java9

---
 .../net/sourceforge/jtds/jdbc/SharedSocket.java    |   6 +-
 .../sourceforge/jtds/ssl/SocketFactoriesSUN.java   | 200 ---------------------
 2 files changed, 2 insertions(+), 204 deletions(-)
 delete mode 100644 src/main/net/sourceforge/jtds/ssl/SocketFactoriesSUN.java

diff --git a/src/main/net/sourceforge/jtds/jdbc/SharedSocket.java b/src/main/net/sourceforge/jtds/jdbc/SharedSocket.java
index d22a834..599b724 100644
--- a/src/main/net/sourceforge/jtds/jdbc/SharedSocket.java
+++ b/src/main/net/sourceforge/jtds/jdbc/SharedSocket.java
@@ -336,9 +336,7 @@ class SharedSocket {
      */
     void enableEncryption(String ssl) throws IOException {
         Logger.println("Enabling TLS encryption");
-        SocketFactory sf = Driver.JDBC3 ? 
-                 SocketFactories.getSocketFactory(ssl, socket)
-               : SocketFactoriesSUN.getSocketFactory(ssl, socket);
+        SocketFactory sf = SocketFactories.getSocketFactory(ssl, socket);
         sslSocket = sf.createSocket(getHost(), getPort());
         setOut(new DataOutputStream(sslSocket.getOutputStream()));
         setIn(new DataInputStream(sslSocket.getInputStream()));
@@ -1063,4 +1061,4 @@ class SharedSocket {
         super.finalize();
     }
 
-}
\ No newline at end of file
+}
diff --git a/src/main/net/sourceforge/jtds/ssl/SocketFactoriesSUN.java b/src/main/net/sourceforge/jtds/ssl/SocketFactoriesSUN.java
deleted file mode 100644
index da29ddb..0000000
--- a/src/main/net/sourceforge/jtds/ssl/SocketFactoriesSUN.java
+++ /dev/null
@@ -1,200 +0,0 @@
-// jTDS JDBC Driver for Microsoft SQL Server and Sybase
-//Copyright (C) 2004 The jTDS Project
-//
-//This library is free software; you can redistribute it and/or
-//modify it under the terms of the GNU Lesser General Public
-//License as published by the Free Software Foundation; either
-//version 2.1 of the License, or (at your option) any later version.
-//
-//This library is distributed in the hope that it will be useful,
-//but WITHOUT ANY WARRANTY; without even the implied warranty of
-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-//Lesser General Public License for more details.
-//
-//You should have received a copy of the GNU Lesser General Public
-//License along with this library; if not, write to the Free Software
-//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-package net.sourceforge.jtds.ssl;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.security.GeneralSecurityException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.X509Certificate;
-import javax.net.SocketFactory;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-import com.sun.net.ssl.SSLContext;
-import com.sun.net.ssl.TrustManager;
-import com.sun.net.ssl.X509TrustManager;
-
-import net.sourceforge.jtds.util.Logger;
-
-/**
- * Used for acquiring a socket factory when SSL is enabled.
- *
- * @author Rob Worsnop
- * @author Mike Hutchinson
- * @version $Id: SocketFactoriesSUN.java,v 1.1.2.1 2009/12/30 14:32:51 ickzon Exp $
- */
-public class SocketFactoriesSUN {
-    /**
-     * Returns a socket factory, the behavior of which will depend on the SSL
-     * setting and whether or not the DB server supports SSL.
-     *
-     * @param ssl    the SSL setting
-     * @param socket plain TCP/IP socket to wrap
-     */
-    public static SocketFactory getSocketFactory(String ssl, Socket socket) {
-        return new TdsTlsSocketFactory(ssl, socket);
-    }
-
-    /**
-     * The socket factory for creating sockets based on the SSL setting.
-     */
-    private static class TdsTlsSocketFactory extends SocketFactory {
-        private static SSLSocketFactory factorySingleton;
-
-        private final String ssl;
-        private final Socket socket;
-
-        /**
-         * Constructs a TdsTlsSocketFactory.
-         *
-         * @param ssl      the SSL setting
-         * @param socket   the TCP/IP socket to wrap
-         */
-        public TdsTlsSocketFactory(String ssl, Socket socket) {
-            this.ssl = ssl;
-            this.socket = socket;
-        }
-
-        /**
-         * Create the SSL socket.
-         * <p/>
-         * NB. This method will actually create a connected socket over the
-         * TCP/IP network socket supplied via the constructor of this factory
-         * class.
-         */
-        public Socket createSocket(String host, int port)
-                throws IOException, UnknownHostException {
-            SSLSocket sslSocket = (SSLSocket) getFactory()
-                    .createSocket(new TdsTlsSocket(socket), host, port, true);
-            //
-            // See if connecting to local server.
-            // getLocalHost() will normally return the address of a real
-            // local network interface so we check that one and the loopback
-            // address localhost/127.0.0.1
-            //
-            // XXX: Disable TLS resume altogether, because the cause of local
-            // server failures is unknown and it also seems to sometiles occur
-            // with remote servers.
-            //
-//            if (socket.getInetAddress().equals(InetAddress.getLocalHost()) ||
-//                host.equalsIgnoreCase("localhost") || host.startsWith("127.")) {
-                // Resume session causes failures with a local server
-                // Invalidate the session to prevent resumes.
-                sslSocket.startHandshake(); // Any IOException thrown here
-                sslSocket.getSession().invalidate();
-//                Logger.println("TLS Resume disabled");
-//            }
-
-            return sslSocket;
-        }
-
-        /*
-         * (non-Javadoc)
-         *
-         * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int)
-         */
-        public Socket createSocket(InetAddress host, int port)
-                throws IOException {
-            return null;
-        }
-
-        /*
-         * (non-Javadoc)
-         *
-         * @see javax.net.SocketFactory#createSocket(java.lang.String, int,
-         *      java.net.InetAddress, int)
-         */
-        public Socket createSocket(String host, int port,
-                                   InetAddress localHost, int localPort) throws IOException,
-                UnknownHostException {
-            return null;
-        }
-
-        /*
-         * (non-Javadoc)
-         *
-         * @see javax.net.SocketFactory#createSocket(java.net.InetAddress, int,
-         *      java.net.InetAddress, int)
-         */
-        public Socket createSocket(InetAddress host, int port,
-                                   InetAddress localHost, int localPort) throws IOException {
-            return null;
-        }
-
-        /**
-         * Returns an SSLSocketFactory whose behavior will depend on the SSL
-         * setting.
-         *
-         * @return an <code>SSLSocketFactory</code>
-         */
-        private SSLSocketFactory getFactory() throws IOException {
-            try {
-                if (Ssl.SSL_AUTHENTICATE.equals(ssl)) {
-                    // the default factory will produce a socket that authenticates
-                    // the server using its certificate chain.
-                    return (SSLSocketFactory) SSLSocketFactory.getDefault();
-                } else {
-                    // Our custom factory will not authenticate the server.
-                    return factory();
-                }
-            } catch (GeneralSecurityException e) {
-                Logger.logException(e);
-                throw new IOException(e.getMessage());
-            }
-        }
-
-        /**
-         * Returns an SSLSocketFactory whose sockets will not authenticate the
-         * server.
-         *
-         * @return an <code>SSLSocketFactory</code>
-         */
-        private static SSLSocketFactory factory()
-                throws NoSuchAlgorithmException, KeyManagementException {
-            if (factorySingleton == null) {
-                SSLContext ctx = SSLContext.getInstance("TLS");
-                ctx.init(null, trustManagers(), null);
-                factorySingleton = ctx.getSocketFactory();
-            }
-            return factorySingleton;
-        }
-
-        private static TrustManager[] trustManagers() {
-            X509TrustManager tm = new X509TrustManager() {
-                public X509Certificate[] getAcceptedIssuers() {
-                    return new X509Certificate[0];
-                }
-
-                public boolean isClientTrusted(X509Certificate[] chain) {
-                    return true;
-                }
-
-                public boolean isServerTrusted(X509Certificate[] chain) {
-                    return true;
-                }
-            };
-
-            return new X509TrustManager[]{tm};
-        }
-
-    }
-}
\ No newline at end of file