Ticket #503 (closed Bug report: worksforme)

Opened 10 years ago

Last modified 10 years ago

Offsite login fails with multiple networks

Reported by: maikel@… Owned by:
Priority: normal Milestone: Not yet assigned to a Milestone
Component: Auth server, Other Version:
Keywords: Cc:

Description

When having a server setup with 1 network, all works correctly. After adding a second network and vhost, this is the error one gets:

Detailed error was: Uncaught Exception The network with id could not be found in the database (0) thrown in file /var/www/localhost/htdocs/wifidog/classes/Network.php, line 363 #0 /var/www/localhost/htdocs/wifidog/classes/Network.php(90): Network->construct() #1 /var/www/localhost/htdocs/wifidog/classes/Authenticator.php(81): Network::getObject() #2 /var/www/localhost/htdocs/wifidog/classes/Authenticators/AuthenticatorLocalUser.php(77): Authenticator->construct() #3 [internal function]: AuthenticatorLocalUser?->construct() #4 [internal function]: ReflectionClass?->newInstance() #5 /var/www/localhost/htdocs/wifidog/classes/Network.php(667): call_user_func_array(Array, Array) #6 /var/www/localhost/htdocs/wifidog/classes/Authenticator.php(158): Network->getAuthenticator() #7 /var/www/localhost/htdocs/wifidog/login/index.php(258): Authenticator::getLoginUI() #8 {main}

It seems that this class doesnt get the network id set from the vhost function

Change History

Changed 10 years ago by Robin Jones

was there a space in the network ID?

Changed 10 years ago by julien.desfossez@…

I have come across the exact same problem when dealing with multiple networks.

The following patch helped me solve this problem :

--- wifidog.orig/classes/Network.php    2009-05-06 17:58:12.000000000 -0400
+++ wifidog/classes/Network.php 2009-05-12 08:56:45.000000000 -0400
@@ -354,6 +366,9 @@
     {
         $db = AbstractDb::getObject();
         $network_id_str = $db->escapeString($p_network_id);
+        if ($network_id_str == "")
+            $network_id_str = $db->escapeString(self::getDefaultNetwork()->getId());
+
         $sql = "SELECT *, EXTRACT(EPOCH FROM validation_grace_time) as validation_grace_time_seconds FROM networks WHERE network_id='$network_id_str'";
         $row = null;
         $db->execSqlUniqueRes($sql, $row, false);

Changed 10 years ago by benoitg

  • status changed from new to closed
  • resolution set to worksforme

The problem is that you didn't set your authenticator constructor parameters when you created your network. The patch above is incorrect, it would cause authentication against the default network.

Note: See TracTickets for help on using tickets.