1 ///*****************************************************/
\r
2 ///* This java file is a part of the */
\r
4 ///* - Plouf's Java IRC Client - */
\r
6 ///* Copyright (C) 2002 - 2004 Philippe Detournay */
\r
8 ///* All contacts : theplouf@yahoo.com */
\r
10 ///* PJIRC is free software; you can redistribute */
\r
11 ///* it and/or modify it under the terms of the GNU */
\r
12 ///* General Public License as published by the */
\r
13 ///* Free Software Foundation; version 2 or later of */
\r
14 ///* the License. */
\r
16 ///* PJIRC is distributed in the hope that it will */
\r
17 ///* be useful, but WITHOUT ANY WARRANTY; without */
\r
18 ///* even the implied warranty of MERCHANTABILITY or */
\r
19 ///* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
\r
20 ///* General Public License for more details. */
\r
22 ///* You should have received a copy of the GNU */
\r
23 ///* General Public License along with PJIRC; if */
\r
24 ///* not, write to the Free Software Foundation, */
\r
25 ///* Inc., 59 Temple Place, Suite 330, Boston, */
\r
26 ///* MA 02111-1307 USA */
\r
28 ///*****************************************************/
\r
30 //package irc.security.prv;
\r
32 //import irc.security.SecuredProvider;
\r
34 //import java.awt.FileDialog;
\r
35 //import java.awt.Frame;
\r
36 //import java.io.File;
\r
37 //import java.io.FileInputStream;
\r
38 //import java.io.FileOutputStream;
\r
39 //import java.io.IOException;
\r
40 //import java.net.InetAddress;
\r
41 //import java.net.ServerSocket;
\r
42 //import java.net.Socket;
\r
43 //import java.net.UnknownHostException;
\r
46 // * Specific secured provider to use with microsoft internet explorer.
\r
48 //public class SpecificMSSecuredProvider implements SecuredProvider {
\r
51 // public Socket getSocket(String host, Integer port)
\r
52 // throws UnknownHostException, IOException {
\r
54 // PolicyEngine.assertPermission(PermissionID.NETIO);
\r
55 // return new Socket(host, port.intValue());
\r
56 // } catch (Throwable e) {
\r
57 // return new Socket(host, port.intValue());
\r
62 // public ServerSocket getServerSocket(Integer port) throws IOException {
\r
64 // PolicyEngine.assertPermission(PermissionID.NETIO);
\r
65 // return new SpecificMSSecuredServerSocket(port.intValue());
\r
66 // } catch (Throwable e) {
\r
67 // return new SpecificMSSecuredServerSocket(port.intValue());
\r
72 // public FileInputStream getFileInputStream(File file) throws IOException {
\r
74 // PolicyEngine.assertPermission(PermissionID.FILEIO);
\r
75 // return new FileInputStream(file);
\r
76 // } catch (Throwable e) {
\r
77 // return new FileInputStream(file);
\r
82 // public Integer getFileSize(File file) {
\r
84 // PolicyEngine.assertPermission(PermissionID.FILEIO);
\r
85 // return new Integer((int) file.length());
\r
86 // } catch (Throwable e) {
\r
87 // return new Integer((int) file.length());
\r
92 // public FileOutputStream getFileOutputStream(File file) throws IOException {
\r
94 // PolicyEngine.assertPermission(PermissionID.FILEIO);
\r
95 // return new FileOutputStream(file);
\r
96 // } catch (Throwable e) {
\r
97 // return new FileOutputStream(file);
\r
102 // * Open a file dialog.
\r
105 // * parent window.
\r
110 // * @return newly created file dialog.
\r
112 // public FileDialog getFileDialog(Frame top, String title, int type) {
\r
114 // PolicyEngine.assertPermission(PermissionID.UI);
\r
115 // return new FileDialog(top, title, type);
\r
116 // } catch (Throwable e) {
\r
117 // return new FileDialog(top, title, type);
\r
122 // public File getLoadFile(String title) {
\r
124 // PolicyEngine.assertPermission(PermissionID.UI);
\r
125 // Frame f = new Frame();
\r
126 // FileDialog dlg = new FileDialog(f, title, FileDialog.LOAD);
\r
128 // File ans = null;
\r
129 // if (dlg.getFile() != null)
\r
130 // ans = new File(dlg.getDirectory() + dlg.getFile());
\r
135 // } catch (Throwable e) {
\r
136 // Frame f = new Frame();
\r
137 // FileDialog dlg = new FileDialog(f, title, FileDialog.LOAD);
\r
139 // File ans = null;
\r
140 // if (dlg.getFile() != null)
\r
141 // ans = new File(dlg.getDirectory() + dlg.getFile());
\r
150 // public File getSaveFile(String title) {
\r
152 // PolicyEngine.assertPermission(PermissionID.UI);
\r
153 // Frame f = new Frame();
\r
154 // FileDialog dlg = new FileDialog(f, title, FileDialog.SAVE);
\r
156 // File ans = new File(dlg.getDirectory() + dlg.getFile());
\r
161 // } catch (Throwable e) {
\r
162 // Frame f = new Frame();
\r
163 // FileDialog dlg = new FileDialog(f, title, FileDialog.SAVE);
\r
165 // File ans = new File(dlg.getDirectory() + dlg.getFile());
\r
174 // public File getSaveFile(String file, String title) {
\r
176 // PolicyEngine.assertPermission(PermissionID.UI);
\r
177 // Frame f = new Frame();
\r
178 // FileDialog dlg = new FileDialog(f, title, FileDialog.SAVE);
\r
179 // dlg.setFile(file);
\r
181 // File ans = new File(dlg.getDirectory() + dlg.getFile());
\r
186 // } catch (Throwable e) {
\r
187 // Frame f = new Frame();
\r
188 // FileDialog dlg = new FileDialog(f, title, FileDialog.SAVE);
\r
189 // dlg.setFile(file);
\r
191 // File ans = new File(dlg.getDirectory() + dlg.getFile());
\r
200 // public InetAddress getLocalHost() throws UnknownHostException {
\r
202 // PolicyEngine.assertPermission(PermissionID.NETIO);
\r
203 // InetAddress[] addresses = InetAddress.getAllByName(InetAddress
\r
204 // .getLocalHost().getHostName());
\r
205 // return addresses[addresses.length - 1];
\r
206 // } catch (Throwable e) {
\r
207 // InetAddress[] addresses = InetAddress.getAllByName(InetAddress
\r
208 // .getLocalHost().getHostName());
\r
209 // return addresses[addresses.length - 1];
\r
214 // public String resolve(InetAddress addr) {
\r
216 // PolicyEngine.assertPermission(PermissionID.NETIO);
\r
217 // return addr.getHostName();
\r
218 // } catch (Throwable e) {
\r
219 // return addr.getHostName();
\r
225 // public boolean tryProvider() {
\r
227 // PolicyEngine.assertPermission(PermissionID.FILEIO);
\r
228 // PolicyEngine.assertPermission(PermissionID.NETIO);
\r
229 // PolicyEngine.assertPermission(PermissionID.UI);
\r
231 // } catch (Throwable e) {
\r
237 // public String getName() {
\r
238 // return "Microsoft Internet Explorer Security Provider";
\r