001: // You can redistribute this software and/or modify it under the terms of
002: // the Ozone Core License version 1 published by ozone-db.org.
003: //
004: // The original code and portions created by SMB are
005: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006: //
007: // $Id: OzoneSecurityManager.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
008:
009: package org.ozoneDB.core;
010:
011: import org.ozoneDB.core.DbRemote.CommandThread;
012: import java.io.*;
013: import java.net.*;
014:
015: public class OzoneSecurityManager extends SecurityManager {
016:
017: static boolean enabled = false;
018:
019: Thread thread() {
020: return Thread.currentThread();
021: }
022:
023: public void enable(boolean value) {
024: enabled = value;
025: }
026:
027: boolean is3XThread() {
028: return !isTransaction();
029: }
030:
031: boolean isTransaction() {
032: if (thread() instanceof CommandThread) {
033: return ((CommandThread) thread()).transaction() != null;
034: } else {
035: return false;
036: }
037: }
038:
039: void standardSecurity() {
040: if (enabled) {
041: if (isTransaction()) {
042: throw new SecurityException();
043: }
044: }
045: }
046:
047: public OzoneSecurityManager() {
048: }
049:
050: public void checkAccept(String host, int port) {
051: standardSecurity();
052: }
053:
054: public void checkAccess(Thread thread) {
055: standardSecurity();
056: }
057:
058: public void checkAccess(ThreadGroup threadGroup) {
059: standardSecurity();
060: }
061:
062: public void checkAwtEventQueueAccess() {
063: standardSecurity();
064: }
065:
066: public void checkConnect(String host, int port) {
067: standardSecurity();
068: }
069:
070: public void checkConnect(String host, int port, Object obj) {
071: standardSecurity();
072: }
073:
074: public void checkCreateClassLoader() {
075: standardSecurity();
076: }
077:
078: public void checkDelete(String file) {
079: standardSecurity();
080: }
081:
082: public void checkExec(String command) {
083: standardSecurity();
084: }
085:
086: public void checkExit(int code) {
087: if (enabled) {
088: throw new SecurityException();
089: }
090: }
091:
092: public void checkLink(String library) {
093: standardSecurity();
094: }
095:
096: public void checkListen(int port) {
097: standardSecurity();
098: }
099:
100: public void checkMemberAccess(Class clazz, int which) {
101: }
102:
103: public void checkMulitcast(InetAddress add, byte ip) {
104: standardSecurity();
105: }
106:
107: public void checkPackageAccess(String pkg) {
108: }
109:
110: public void checkPackageDefinition(String pkg) {
111: }
112:
113: public void checkPermission(java.security.Permission perm,
114: Object context) {
115: }
116:
117: /**
118: * Allow ObjectOutputStream.enableReplceObject() to be set to true.
119: */
120: public void checkPermission(java.security.Permission perm) {
121: }
122:
123: public void checkPrintJobAccess() {
124: }
125:
126: public void checkPropertiesAccess() {
127: }
128:
129: public void checkPropertyAccess(String prop) {
130: }
131:
132: public void checkRead(FileDescriptor fd) {
133: }
134:
135: public void checkRead(String file) {
136: }
137:
138: public void checkRead(String file, Object obj) {
139: }
140:
141: public void checkSecurityAccess(String action) {
142: }
143:
144: public void checkSetFactory() {
145: }
146:
147: public void checkSystemClipboardAccess() {
148: }
149:
150: public boolean checkTopLevelWindow(Object window) {
151: // in case of LocalDatabase this would also prevent the client
152: // from havin a GUI
153: // throw new SecurityException();
154: return true;
155: }
156:
157: public void checkWrite(FileDescriptor fd) {
158: }
159:
160: public void checkWrite(String file) {
161: }
162: }
|