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
e6d7a121
Commit
e6d7a121
authored
Feb 19, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugins: add hooks for services
(cherry picked from commit
9709336b
)
parent
e23a462e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
1 deletion
+52
-1
plugins.inc
src/etc/inc/plugins.inc
+18
-0
vpn.inc
src/etc/inc/plugins.inc.d/vpn.inc
+17
-0
services.inc
src/etc/inc/services.inc
+7
-0
diag_logs_pptp.php
src/www/diag_logs_pptp.php
+3
-0
vpn_pptp.php
src/www/vpn_pptp.php
+4
-1
vpn_pptp_users.php
src/www/vpn_pptp_users.php
+3
-0
No files found.
src/etc/inc/plugins.inc
View file @
e6d7a121
...
...
@@ -49,6 +49,24 @@ function plugin_scan()
return
$ret
;
}
function
plugins_services
()
{
$services
=
array
();
foreach
(
plugin_scan
()
as
$name
=>
$path
)
{
require_once
$path
;
$func
=
sprintf
(
'%s_services'
,
$name
);
if
(
function_exists
(
$func
))
{
$workers
=
$func
();
foreach
(
$workers
as
$work
)
{
$services
[]
=
$work
;
}
}
}
return
$services
;
}
function
plugins_configure
()
{
foreach
(
plugin_scan
()
as
$name
=>
$path
)
{
...
...
src/etc/inc/plugins.inc.d/vpn.inc
View file @
e6d7a121
...
...
@@ -38,6 +38,23 @@ function vpn_configure()
);
}
function
vpn_services
()
{
global
$config
;
$services
=
array
();
if
(
isset
(
$config
[
'pptpd'
][
'mode'
])
&&
$config
[
'pptpd'
][
'mode'
]
==
'server'
)
{
$pconfig
=
array
();
$pconfig
[
'name'
]
=
'pptpd'
;
$pconfig
[
'description'
]
=
gettext
(
'PPTP Server'
);
$pconfig
[
'pidfile'
]
=
'/var/run/pptp-vpn.pid'
;
$services
[]
=
$pconfig
;
}
return
$services
;
}
function
vpn_netgraph_support
()
{
$iflist
=
get_configured_interface_list
();
foreach
(
$iflist
as
$iface
)
{
...
...
src/etc/inc/services.inc
View file @
e6d7a121
...
...
@@ -2754,6 +2754,13 @@ function find_service_by_name($names, $filter = array())
$services
=
services_get
();
if
(
function_exists
(
'plugins_services'
))
{
/* only pull plugins if plugins.inc was included before */
foreach
(
plugins_services
()
as
$service
)
{
$services
[]
=
$service
;
}
}
foreach
(
$services
as
$service
)
{
foreach
(
$names
as
$name
)
{
if
(
$service
[
'name'
]
!=
$name
)
{
...
...
src/www/diag_logs_pptp.php
View file @
e6d7a121
...
...
@@ -19,4 +19,7 @@ $tab_array = array();
$tab_array
[]
=
array
(
gettext
(
"PPTP Logins"
),
$mode
!=
"raw"
,
"/diag_logs_pptp.php"
);
$tab_array
[]
=
array
(
gettext
(
"PPTP Raw"
),
$mode
==
"raw"
,
"/diag_logs_pptp.php?mode=raw"
);
require_once
'services.inc'
;
$service_hook
=
'pptpd'
;
require_once
'diag_logs_vpn.inc'
;
src/www/vpn_pptp.php
View file @
e6d7a121
...
...
@@ -30,8 +30,9 @@
require_once
(
'guiconfig.inc'
);
require_once
(
'interfaces.inc'
);
require_once
(
'filter.inc'
);
require_once
(
'
plugins.inc.d/vpn
.inc'
);
require_once
(
'
services
.inc'
);
require_once
(
"pfsense-utils.inc"
);
require_once
(
'plugins.inc.d/vpn.inc'
);
if
(
!
is_array
(
$config
[
'pptpd'
][
'radius'
]))
{
$config
[
'pptpd'
][
'radius'
]
=
array
();
...
...
@@ -193,6 +194,8 @@ if ($_POST) {
}
}
$service_hook
=
'pptpd'
;
include
(
"head.inc"
);
?>
...
...
src/www/vpn_pptp_users.php
View file @
e6d7a121
...
...
@@ -28,6 +28,7 @@
*/
require_once
(
'guiconfig.inc'
);
require_once
(
'services.inc'
);
require_once
(
'plugins.inc.d/vpn.inc'
);
if
(
!
is_array
(
$config
[
'pptpd'
][
'user'
]))
{
...
...
@@ -55,6 +56,8 @@ if ($_GET['act'] == "del") {
}
}
$service_hook
=
'pptpd'
;
include
(
"head.inc"
);
$main_buttons
=
array
(
...
...
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