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; |
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 |
|
} |
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"); |