1 11 package org.eclipse.ant.internal.core.ant; 12 13 14 import java.io.FileDescriptor ; 15 import java.net.InetAddress ; 16 import java.net.SocketPermission ; 17 import java.security.Permission ; 18 19 import org.eclipse.ant.core.AntSecurityException; 20 21 28 public class AntSecurityManager extends SecurityManager { 29 30 protected SecurityManager securityManager= null; 31 32 protected AntSecurityManager(SecurityManager securityManager) { 33 this.securityManager= securityManager; 34 } 35 38 public void checkExit(int status) { 39 throw new AntSecurityException(); 45 } 46 49 public void checkAccept(String host, int port) { 50 if (securityManager != null) { 51 securityManager.checkAccept(host, port); 52 } 53 } 54 55 58 public void checkAccess(Thread t) { 59 if (securityManager != null) { 60 securityManager.checkAccess(t); 61 } 62 } 63 64 67 public void checkAccess(ThreadGroup g) { 68 if (securityManager != null) { 69 securityManager.checkAccess(g); 70 } 71 } 72 73 76 public void checkAwtEventQueueAccess() { 77 if (securityManager != null) { 78 securityManager.checkAwtEventQueueAccess(); 79 } 80 } 81 82 85 public void checkConnect(String host, int port, Object context) { 86 if (securityManager != null) { 87 securityManager.checkConnect(host, port, context); 88 } 89 } 90 91 94 public void checkConnect(String host, int port) { 95 if (securityManager != null) { 96 securityManager.checkConnect(host, port); 97 } 98 } 99 100 103 public void checkCreateClassLoader() { 104 if (securityManager != null) { 105 securityManager.checkCreateClassLoader(); 106 } 107 } 108 109 112 public void checkDelete(String file) { 113 if (securityManager != null) { 114 securityManager.checkDelete(file); 115 } 116 } 117 118 121 public void checkExec(String cmd) { 122 if (securityManager != null) { 123 securityManager.checkExec(cmd); 124 } 125 } 126 127 130 public void checkLink(String lib) { 131 if (securityManager != null) { 132 securityManager.checkLink(lib); 133 } 134 } 135 136 139 public void checkListen(int port) { 140 if (securityManager != null) { 141 securityManager.checkListen(port); 142 } 143 } 144 145 148 public void checkMemberAccess(Class clazz, int which) { 149 if (securityManager != null) { 150 securityManager.checkMemberAccess(clazz, which); 151 } 152 } 153 154 158 public void checkMulticast(InetAddress maddr, byte ttl) { 159 if (securityManager != null) { 160 String host = maddr.getHostAddress(); 161 if (!host.startsWith("[") && host.indexOf(':') != -1) { host = "[" + host + "]"; } 164 checkPermission(new SocketPermission (host, "accept,connect")); } 166 } 167 168 171 public void checkMulticast(InetAddress maddr) { 172 if (securityManager != null) { 173 securityManager.checkMulticast(maddr); 174 } 175 } 176 177 180 public void checkPackageAccess(String pkg) { 181 if (securityManager != null) { 182 securityManager.checkPackageAccess(pkg); 183 } 184 } 185 186 189 public void checkPackageDefinition(String pkg) { 190 if (securityManager != null) { 191 securityManager.checkPackageDefinition(pkg); 192 } 193 } 194 195 198 public void checkPermission(Permission perm, Object context) { 199 if (securityManager != null) { 200 securityManager.checkPermission(perm, context); 201 } 202 } 203 204 207 public void checkPermission(Permission perm) { 208 if (securityManager != null) { 209 securityManager.checkPermission(perm); 210 } 211 } 212 213 216 public void checkPrintJobAccess() { 217 if (securityManager != null) { 218 securityManager.checkPrintJobAccess(); 219 } 220 } 221 222 225 public void checkPropertiesAccess() { 226 if (securityManager != null) { 227 securityManager.checkPropertiesAccess(); 228 } 229 } 230 231 234 public void checkPropertyAccess(String key) { 235 if (securityManager != null) { 236 securityManager.checkPropertyAccess(key); 237 } 238 } 239 240 243 public void checkRead(FileDescriptor fd) { 244 if (securityManager != null) { 245 securityManager.checkRead(fd); 246 } 247 } 248 249 252 public void checkRead(String file, Object context) { 253 if (securityManager != null) { 254 securityManager.checkRead(file, context); 255 } 256 } 257 258 261 public void checkRead(String file) { 262 if (securityManager != null) { 263 securityManager.checkRead(file); 264 } 265 } 266 267 270 public void checkSecurityAccess(String target) { 271 if (securityManager != null) { 272 securityManager.checkSecurityAccess(target); 273 } 274 } 275 276 279 public void checkSetFactory() { 280 if (securityManager != null) { 281 securityManager.checkSetFactory(); 282 } 283 } 284 285 288 public void checkSystemClipboardAccess() { 289 if (securityManager != null) { 290 securityManager.checkSystemClipboardAccess(); 291 } 292 } 293 294 297 public boolean checkTopLevelWindow(Object window) { 298 if (securityManager != null) { 299 return securityManager.checkTopLevelWindow(window); 300 } 301 return super.checkTopLevelWindow(window); 302 } 303 304 307 public void checkWrite(FileDescriptor fd) { 308 if (securityManager != null) { 309 securityManager.checkWrite(fd); 310 } 311 } 312 313 316 public void checkWrite(String file) { 317 if (securityManager != null) { 318 securityManager.checkWrite(file); 319 } 320 } 321 322 326 public boolean getInCheck() { 327 if (securityManager != null) { 328 return securityManager.getInCheck(); 329 } 330 return super.getInCheck(); 331 } 332 333 336 public Object getSecurityContext() { 337 if (securityManager != null) { 338 return securityManager.getSecurityContext(); 339 } 340 return super.getSecurityContext(); 341 } 342 343 346 public ThreadGroup getThreadGroup() { 347 if (securityManager != null) { 348 securityManager.getThreadGroup(); 349 } 350 return super.getThreadGroup(); 351 } 352 } | Popular Tags |