OPNsense Forum

Archive => 15.1 Legacy Series => Topic started by: UGUR on June 15, 2015, 11:47:16 am

Title: [SOLVED] Captive Portal Error
Post by: UGUR on June 15, 2015, 11:47:16 am
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such table: captiveportal_ip' in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php:342 Stack trace: #0 [internal function]: PDO->prepare('select ip,pipen...') #1 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php(342): Phalcon\Db\Adapter\Pdo->query('select ip,pipen...') #2 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(162): OPNsense\CaptivePortal\DB->listFixedIPs() #3 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(147): OPNsense\CaptivePortal\CPClient->refreshAllowedIPs(NULL) #4 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(107): OPNsense\CaptivePortal\CPClient->update() #5 /usr/local/etc/inc/captiveportal.inc(229): OPNsense\CaptivePortal\CPClient->reconfigure() #6 /usr/local/etc/inc/captiveportal.inc(337): captiveportal_init_rules(true) #7 /usr/local/www/services_captiveportal.php(386): captiveportal_configure() #8 {main} in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php on line 342
Title: Re: Captive Portal Error
Post by: franco on June 15, 2015, 11:49:46 am
Hi there,

Ad wrote the code, but he is on vacation this week. He'll look at this as soon as he is back.


Cheers,
Franco
Title: Re: Captive Portal Error
Post by: remonboonstra on June 16, 2015, 02:13:20 pm
Same issue here.

Let me know, as I needed it this week :) -- broken m0n0wall server replacement
Ordered the appliance A10, mainly doing captive portal stuff.

Can I downgrade?

Thanks

Remon
Title: Re: Captive Portal Error
Post by: franco on June 16, 2015, 02:57:10 pm
Hi Remon,

downgrade to? I have no version information here, no info about when this started to happen or if it was working previously at all.

15.1.12 is coming out tomorrow. I'd rather have this pinned down before that happens.


Cheers,
Franco
Title: Re: Captive Portal Error
Post by: remonboonstra on June 16, 2015, 03:49:18 pm
Hi Franco,

I can create a Captive Portal in disabled state, when enabling (without changing any setting on the form) it fails:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such table: captiveportal_ip' in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php:342 Stack trace: #0 [internal function]: PDO->prepare('select ip,pipen...') #1 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php(342): Phalcon\Db\Adapter\Pdo->query('select ip,pipen...') #2 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(162): OPNsense\CaptivePortal\DB->listFixedIPs() #3 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(147): OPNsense\CaptivePortal\CPClient->refreshAllowedIPs(NULL) #4 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(107): OPNsense\CaptivePortal\CPClient->update() #5 /usr/local/etc/inc/captiveportal.inc(229): OPNsense\CaptivePortal\CPClient->reconfigure() #6 /usr/local/etc/inc/captiveportal.inc(337): captiveportal_init_rules(true) #7 /usr/local/www/services_captiveportal_zones.php(47): captiveportal_configure() #8 {ma in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php on line 342


Crash Reporter:

System Information:
FreeBSD 10.1-RELEASE-p10 #0 a5b56aa(master): Mon May 18 14:54:06 CEST 2015     root@sensey64:/usr/obj/usr/src/sys/SMP
OPNsense 15.1.11.4-d34b25558 (amd64)
OpenSSL 1.0.2b 11 Jun 2015

PHP Errors:
[16-Jun-2015 14:44:17 Europe/Amsterdam] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 no such table: captiveportal_ip' in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php:342
Stack trace:
#0 [internal function]: PDO->prepare('select ip,pipen...')
#1 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php(342): Phalcon\Db\Adapter\Pdo->query('select ip,pipen...')
#2 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(162): OPNsense\CaptivePortal\DB->listFixedIPs()
#3 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(147): OPNsense\CaptivePortal\CPClient->refreshAllowedIPs(NULL)
#4 /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CPClient.php(107): OPNsense\CaptivePortal\CPClient->update()
#5 /usr/local/etc/inc/captiveportal.inc(229): OPNsense\CaptivePortal\CPClient->reconfigure()
#6 /usr/local/etc/inc/captiveportal.inc(337): captiveportal_init_rules(true)
#7 /usr/local/www/services_captiveportal.php(386): captiveportal_configure()
#8 {main}
  in /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php on line 342


Thank you!
Title: Re: Captive Portal Error
Post by: Supermule on June 16, 2015, 04:13:55 pm
Could this in any way be related to the seldom seen time zone error(NTP)??
Title: Re: Captive Portal Error
Post by: franco on June 16, 2015, 06:19:42 pm
Don't think so, this is brand new. I can see it now. Reporting back in a bit.
Title: Re: Captive Portal Error
Post by: remonboonstra on June 16, 2015, 06:57:17 pm
Franco,

Thanks for checking this quick! Let me know if I need/can test anything!

Regard Remon
Title: Re: Captive Portal Error
Post by: franco on June 16, 2015, 07:15:40 pm
Hi Remon,

fixed, details see: https://github.com/opnsense/core/issues/215

Will be part of tomorrow's 15.1.12. If you want to test run these commands on the (ssh) shell of your OPNsense box:

# rm /var/db/captiveportal*.db
# cd /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/
# fetch https://raw.githubusercontent.com/opnsense/core/eac7cdde65742b5bd7529c767588843b28fd09a6/src/opnsense/mvc/app/models/OPNsense/CaptivePortal/DB.php

And simply retry in the GUI.

As far as the bug goes: PHP or Phalcon internals changed with a recent upgrade for PDO/Sqlite adapters, someone hardened against SQL injection,removing the database creation queries behind the first ";". Sorry about that.

Thanks for helping me to reproduce the error. :)


Cheers,
Franco
Title: Re: [SOLVED] Captive Portal Error
Post by: remonboonstra on June 16, 2015, 08:04:41 pm
Franco,

Thank you, for the quick reply and the quick solution!
Tomorrow I will update to .12 , can't check today (sick).

Regards,
Remon
Title: Re: [SOLVED] Captive Portal Error
Post by: franco on June 16, 2015, 08:05:19 pm
Understood, get well soon!
Title: Re: [SOLVED] Captive Portal Error
Post by: remonboonstra on June 17, 2015, 01:08:21 pm
Franco,

Thank you, it works (tested it manually as suggested).

Kind regards,

Remon