Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1ed14b29
Commit
1ed14b29
authored
Dec 09, 2014
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix phalcon backwards compatibility mode
parent
6f8cea82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
11 deletions
+25
-11
config.php
src/opnsense/mvc/app/config/config.php
+4
-4
CPClient.php
src/opnsense/mvc/app/models/Captiveportal/CPClient.php
+18
-6
load_falcon.php
src/opnsense/mvc/script/load_falcon.php
+2
-0
test.php
src/opnsense/mvc/script/test.php
+1
-1
No files found.
src/opnsense/mvc/app/config/config.php
View file @
1ed14b29
...
...
@@ -18,11 +18,11 @@ return new \Phalcon\Config(array(
'baseUri'
=>
'/opnsense_gui/'
,
),
'globals'
=>
array
(
'config_path'
=>
'
/conf/'
,
'temp_path'
=>
'
/tmp/'
,
'vardb_path'
=>
'/var/db
/'
,
'config_path'
=>
__DIR__
.
'/../../test
/conf/'
,
'temp_path'
=>
__DIR__
.
'/../../test
/tmp/'
,
'vardb_path'
=>
__DIR__
.
'/../../test/tmp
/'
,
'debug'
=>
true
,
'simulate_mode'
=>
fals
e
'simulate_mode'
=>
tru
e
)
));
src/opnsense/mvc/app/models/Captiveportal/CPClient.php
View file @
1ed14b29
...
...
@@ -357,7 +357,7 @@ class CPClient {
* @param string $attributes
* @param string $radiusctx
*/
public
function
portal_allow
(
$cpzonename
,
$clientip
,
$clientmac
,
$username
,
$password
=
null
,
$bw_up
=
null
,
$bw_down
=
null
,
$
attributes
=
null
,
$radiusctx
=
null
){
public
function
portal_allow
(
$cpzonename
,
$clientip
,
$clientmac
,
$username
,
$password
=
null
,
$bw_up
=
null
,
$bw_down
=
null
,
$
radiusctx
=
null
,
$session_timeout
=
null
,
$idle_timeout
=
null
,
$session_terminate_time
=
null
,
$interim_interval
=
null
){
// defines
$exec_commands
=
array
()
;
$db
=
new
DB
(
$cpzonename
);
...
...
@@ -377,7 +377,7 @@ class CPClient {
$cp_table
=
$db
->
listClients
(
array
(
"mac"
=>
$clientmac
,
"ip"
=>
$clientip
),
"or"
);
if
(
sizeof
(
$cp_table
)
>
0
&&
(
$cp_table
[
0
]
->
ip
==
$clientip
&&
$cp_table
[
0
]
->
mac
==
$clientmac
)
){
// nothing (important) changed here... move on
return
;
return
$cp_table
[
0
]
->
sessionid
;
}
elseif
(
sizeof
(
$cp_table
)
>
0
)
{
// something changed...
// prevent additional sessions to popup, one MAC should have only one active session, remove the rest (if any)
...
...
@@ -402,6 +402,9 @@ class CPClient {
$pipeno_out
=
$current_session
->
pipeno_out
;
$db
->
update_session
(
$current_session
->
sessionid
,
array
(
"ip"
=>
$clientip
,
"mac"
=>
$clientmac
));
// preserve session for response
$sessionid
=
$current_session
->
sessionid
;
}
else
{
// new session, allocate new dummynet pipes and generate a unique id
...
...
@@ -416,10 +419,10 @@ class CPClient {
$session_data
[
"pipeno_out"
]
=
$pipeno_out
;
$session_data
[
"username"
]
=
\SQLite3
::
escapeString
(
$username
);
$session_data
[
"bpassword"
]
=
base64_encode
(
$password
);
$session_data
[
"session_timeout"
]
=
-
1
;
$session_data
[
"idle_timeout"
]
=
-
1
;
$session_data
[
"session_terminate_time"
]
=
-
1
;
$session_data
[
"interim_interval"
]
=
-
1
;
$session_data
[
"session_timeout"
]
=
$session_timeout
;
$session_data
[
"idle_timeout"
]
=
$idle_timeout
;
$session_data
[
"session_terminate_time"
]
=
$session_terminate_time
;
$session_data
[
"interim_interval"
]
=
$interim_interval
;
$session_data
[
"radiusctx"
]
=
$radiusctx
;
$session_data
[
"allow_time"
]
=
time
();
// allow time is actual starting time of this session
$sessionid
=
uniqid
()
;
...
...
@@ -439,8 +442,17 @@ class CPClient {
// add accounting rule
$this
->
add_accounting
(
$zoneid
,
$clientip
);
// set bandwidth restrictions
$this
->
reset_bandwidth
(
$pipeno_in
,
$bw_up
);
$this
->
reset_bandwidth
(
$pipeno_in
,
$bw_down
);
// TODO : Add logging, ( captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION"); )
// cleanup
unset
(
$db
);
return
$sessionid
;
}
...
...
src/opnsense/mvc/script/load_falcon.php
View file @
1ed14b29
...
...
@@ -19,3 +19,5 @@ $loader->registerDirs(
)
->
register
();
$di
->
set
(
'config'
,
$config
);
unset
(
$config
);
src/opnsense/mvc/script/test.php
View file @
1ed14b29
<?php
require_once
(
"load_falcon.php"
);
require_once
(
"
script/
load_falcon.php"
);
$cpc
=
new
Captiveportal\CPClient
();
//$cpc->portal_allow("test","10.211.55.101","00:1C:42:49:B7:B2","Fritsx");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment