ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java (file contents):
Revision 1.13 by tdb, Tue May 29 17:02:34 2001 UTC vs.
Revision 1.16 by tdb, Sat May 18 18:16:01 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * Copyright (C) 2000-2002 i-scream
4 + *
5 + * This program is free software; you can redistribute it and/or
6 + * modify it under the terms of the GNU General Public License
7 + * as published by the Free Software Foundation; either version 2
8 + * of the License, or (at your option) any later version.
9 + *
10 + * This program is distributed in the hope that it will be useful,
11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 + * GNU General Public License for more details.
14 + *
15 + * You should have received a copy of the GNU General Public License
16 + * along with this program; if not, write to the Free Software
17 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 + */
19 +
20   //---PACKAGE DECLARATION---
21   package uk.org.iscream.cms.server.clientinterface;
22  
# Line 56 | Line 75 | class TCPClientListener extends Thread {
75           * and then passing them off to handler processes to deal with.
76           */
77      public void run(){
78 +        // setup an empty ACL defaulting to ALLOW
79 +        ACL acl = new ACL(ACL.ALLOW);
80 +        
81          // get our port
82          int portNum;
83          try {
# Line 74 | Line 96 | class TCPClientListener extends Thread {
96          boolean run = true;
97          try{
98                          // Setup the ServerSocket so that clients can connect
99 <            listenPort = new ServerSocket(portNum);
99 >                        listenPort = new ACLServerSocket(acl, portNum);
100          }
101          catch(IOException e){
102          }
# Line 90 | Line 112 | class TCPClientListener extends Thread {
112                                                                                  +"port "+listenPort.getLocalPort());
113                  }
114                  // Loop round constantly until we decide to stop
115 +                ConfigurationProxy cp = ConfigurationProxy.getInstance();
116 +        String stringACL = "";
117 +        String newStringACL = "";
118          while(run){
119 +            // get hold of the ACL in the configuration
120 +            try {
121 +                newStringACL = cp.getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL");
122 +            }
123 +            catch(PropertyNotFoundException e) {
124 +                // if we can't find it, we'll just use a null ACL
125 +                newStringACL = "";
126 +                _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener), using empty ACL instead: " + e);
127 +            }
128 +            // check to see if the ACL has changed
129 +            if(!newStringACL.equals(stringACL)) {
130 +                _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List");
131 +                // clear the ACL
132 +                acl.clear();
133 +                // set the default to something sane
134 +                acl.setDefaultMode(ACL.ALLOW);
135 +                // add the new ACL (this may change the default)
136 +                acl.add(newStringACL);
137 +                stringACL = newStringACL;
138 +            }
139              Socket hostSocket=null;
140              try{
141                  _logger.write(toString(), Logger.SYSMSG, "Waiting for Connection");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines