--- projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java 2002/03/20 12:56:37 1.14 +++ projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java 2002/03/21 13:01:21 1.15 @@ -16,7 +16,7 @@ import java.net.UnknownHostException; * a connection is received. * * @author $Author: tdb $ - * @version $Id: TCPClientListener.java,v 1.14 2002/03/20 12:56:37 tdb Exp $ + * @version $Id: TCPClientListener.java,v 1.15 2002/03/21 13:01:21 tdb Exp $ */ class TCPClientListener extends Thread { @@ -25,7 +25,7 @@ class TCPClientListener extends Thread { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.14 $"; + public final String REVISION = "$Revision: 1.15 $"; public static final int DEFPORT = 4510; @@ -56,15 +56,8 @@ class TCPClientListener extends Thread { * and then passing them off to handler processes to deal with. */ public void run(){ - // get our ACL from the configuration - ACL acl = null; - try { - String stringACL = ConfigurationProxy.getInstance().getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL"); - acl = new ACL(stringACL); - } - catch(PropertyNotFoundException e) { - _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener): " + e); - } + // setup an empty ACL defaulting to ALLOW + ACL acl = new ACL(ACL.ALLOW); // get our port int portNum; @@ -84,13 +77,7 @@ class TCPClientListener extends Thread { boolean run = true; try{ // Setup the ServerSocket so that clients can connect - // use an ACLServerSocket if we have an ACL - if(acl != null) { - listenPort = new ACLServerSocket(acl, portNum); - } - else { - listenPort = new ServerSocket(portNum); - } + listenPort = new ACLServerSocket(acl, portNum); } catch(IOException e){ } @@ -106,7 +93,30 @@ class TCPClientListener extends Thread { +"port "+listenPort.getLocalPort()); } // Loop round constantly until we decide to stop + ConfigurationProxy cp = ConfigurationProxy.getInstance(); + String stringACL = ""; + String newStringACL = ""; while(run){ + // get hold of the ACL in the configuration + try { + newStringACL = cp.getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL"); + } + catch(PropertyNotFoundException e) { + // if we can't find it, we'll just use a null ACL + newStringACL = ""; + _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener), using empty ACL instead: " + e); + } + // check to see if the ACL has changed + if(!newStringACL.equals(stringACL)) { + _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List"); + // clear the ACL + acl.clear(); + // set the default to something sane + acl.setDefaultMode(ACL.ALLOW); + // add the new ACL (this may change the default) + acl.add(newStringACL); + stringACL = newStringACL; + } Socket hostSocket=null; try{ _logger.write(toString(), Logger.SYSMSG, "Waiting for Connection");