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.14 by tdb, Wed Mar 20 12:56:37 2002 UTC vs.
Revision 1.15 by tdb, Thu Mar 21 13:01:21 2002 UTC

# Line 56 | Line 56 | class TCPClientListener extends Thread {
56           * and then passing them off to handler processes to deal with.
57           */
58      public void run(){
59 <        // get our ACL from the configuration
60 <        ACL acl = null;
61 <        try {
62 <            String stringACL = ConfigurationProxy.getInstance().getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL");
63 <            acl = new ACL(stringACL);
64 <        }
65 <        catch(PropertyNotFoundException e) {
66 <            _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener): " + e);
67 <        }
59 >        // setup an empty ACL defaulting to ALLOW
60 >        ACL acl = new ACL(ACL.ALLOW);
61          
62          // get our port
63          int portNum;
# Line 84 | Line 77 | class TCPClientListener extends Thread {
77          boolean run = true;
78          try{
79                          // Setup the ServerSocket so that clients can connect
80 <                        // use an ACLServerSocket if we have an ACL
88 <                        if(acl != null) {
89 <                            listenPort = new ACLServerSocket(acl, portNum);
90 <                        }
91 <                        else {
92 <                listenPort = new ServerSocket(portNum);
93 <            }
80 >                        listenPort = new ACLServerSocket(acl, portNum);
81          }
82          catch(IOException e){
83          }
# Line 106 | Line 93 | class TCPClientListener extends Thread {
93                                                                                  +"port "+listenPort.getLocalPort());
94                  }
95                  // Loop round constantly until we decide to stop
96 +                ConfigurationProxy cp = ConfigurationProxy.getInstance();
97 +        String stringACL = "";
98 +        String newStringACL = "";
99          while(run){
100 +            // get hold of the ACL in the configuration
101 +            try {
102 +                newStringACL = cp.getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL");
103 +            }
104 +            catch(PropertyNotFoundException e) {
105 +                // if we can't find it, we'll just use a null ACL
106 +                newStringACL = "";
107 +                _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener), using empty ACL instead: " + e);
108 +            }
109 +            // check to see if the ACL has changed
110 +            if(!newStringACL.equals(stringACL)) {
111 +                _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List");
112 +                // clear the ACL
113 +                acl.clear();
114 +                // set the default to something sane
115 +                acl.setDefaultMode(ACL.ALLOW);
116 +                // add the new ACL (this may change the default)
117 +                acl.add(newStringACL);
118 +                stringACL = newStringACL;
119 +            }
120              Socket hostSocket=null;
121              try{
122                  _logger.write(toString(), Logger.SYSMSG, "Waiting for Connection");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines