diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2d4be6ddc..f1704c970 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -7,6 +7,7 @@ - fixed #9580: Gallery: albums shown in navigation - fixed #9578: Use of "quotes" in badge name causes error - fixed #9603: moving wiki page + - fixed #9302: Spectre Problem... - fixed #9635: Matrix - Add attributes not working 7.6.10 diff --git a/lib/WebGUI/Operation/Spectre.pm b/lib/WebGUI/Operation/Spectre.pm index b0d2f1fe6..62a426ff4 100644 --- a/lib/WebGUI/Operation/Spectre.pm +++ b/lib/WebGUI/Operation/Spectre.pm @@ -164,7 +164,10 @@ sub www_spectreStatus { =head2 www_spectreTest ( ) -Spectre executes this function to see if WebGUI connectivity is working. +Spectre executes this function to see if WebGUI connectivity is working. Note, the subnet checking +is done in here because it is only, ever intended that Spectre use this method. If a user were to +call this method, it would lie, since it would be checking if the user's IP address was a valid +spectreSubnet, instead of checking the IP address of the spectre process. =cut @@ -172,24 +175,12 @@ sub www_spectreTest { my $session = shift; $session->http->setMimeType("text/plain"); $session->http->setCacheControl("none"); - return WebGUI::Operation::Spectre::spectreTest($session); -} -#------------------------------------------------------------------- - -=head2 spectreTest ( ) - -Spectre executes this function to see if WebGUI connectivity is working. - -=cut - -sub spectreTest{ - my $session = shift; my $subnets = $session->config->get("spectreSubnets"); - if (!defined $subnets) { $subnets = []; } + my $sessionIp = $session->env->getIp; unless (isInSubnet($sessionIp, $subnets)) { $session->errorHandler->security( @@ -198,6 +189,20 @@ sub spectreTest{ ); return "subnet"; } + return WebGUI::Operation::Spectre::spectreTest($session); +} + +#------------------------------------------------------------------- + +=head2 spectreTest ( ) + +Spectre executes this function to see if WebGUI connectivity is working. It does not +do subnet checking, yet. + +=cut + +sub spectreTest{ + my $session = shift; my $remote = create_ikc_client( port=>$session->config->get("spectrePort"), ip=>$session->config->get("spectreIp"), @@ -209,6 +214,13 @@ sub spectreTest{ my $result = $remote->post_respond('admin/ping'); $remote->disconnect; return "spectre" unless defined $result; + ##A real spectre subnet test would go here, and would consist of the following + ##events: + ## 1) WebGUI talks to spectre. + ## 2) Spectre makes a request of WebGUI + ## 3) WebGUI returns a token or an error + ## 4) spectre returns the result of the request to WebGUI + ## 5) WebGUI lets the user know how it all ended up. return "success"; }