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
5f41224e
Commit
5f41224e
authored
Jul 27, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Aug 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy/ldap) integrate our new ldap connector into test page
parent
c75d3605
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
system_usermanager_settings_test.php
src/www/system_usermanager_settings_test.php
+11
-16
No files found.
src/www/system_usermanager_settings_test.php
View file @
5f41224e
...
@@ -30,12 +30,18 @@ require_once("guiconfig.inc");
...
@@ -30,12 +30,18 @@ require_once("guiconfig.inc");
require_once
(
"auth.inc"
);
require_once
(
"auth.inc"
);
include
(
'head.inc'
);
include
(
'head.inc'
);
if
(
isset
(
$config
[
'system'
][
'authserver'
][
0
][
'host'
]))
{
if
(
isset
(
$config
[
'system'
][
'authserver'
][
0
][
'host'
]))
{
$auth_server
=
$config
[
'system'
][
'authserver'
][
0
][
'host'
];
$auth_server
=
$config
[
'system'
][
'authserver'
][
0
][
'host'
];
$authserver
=
$_GET
[
'authserver'
];
$authserver
=
$_GET
[
'authserver'
];
$authcfg
=
auth_get_authserver
(
$authserver
);
$authcfg
=
auth_get_authserver
(
$authserver
);
$ldap_auth
=
new
OPNsense\Auth\LDAP
(
$authcfg
[
'ldap_basedn'
]);
ldap_setup_caenv
(
$authcfg
);
$ldap_is_connected
=
$ldap_auth
->
connect
(
$authcfg
[
'ldap_full_url'
],
$authcfg
[
'ldap_binddn'
],
$authcfg
[
'ldap_bindpw'
]);
}
}
?>
?>
<body>
<body>
...
@@ -50,33 +56,22 @@ if (!$authcfg) {
...
@@ -50,33 +56,22 @@ if (!$authcfg) {
echo
"<tr><th colspan='2'>"
.
sprintf
(
gettext
(
"Testing %s LDAP settings... One moment please..."
),
$g
[
'product_name'
])
.
"</th></tr>"
;
echo
"<tr><th colspan='2'>"
.
sprintf
(
gettext
(
"Testing %s LDAP settings... One moment please..."
),
$g
[
'product_name'
])
.
"</th></tr>"
;
echo
"<tr><td>"
.
gettext
(
"Attempting connection to"
)
.
" "
.
$authserver
.
"</td>"
;
echo
"<tr><td>"
.
gettext
(
"Attempting connection to"
)
.
" "
.
$authserver
.
"</td>"
;
if
(
ldap_test_connection
(
$authcfg
)
)
{
if
(
$ldap_is_connected
)
{
echo
"<td><font color='green'>OK</font></td></tr>"
;
echo
"<td><font color='green'>OK</font></td></tr>"
;
echo
"<tr><td>"
.
gettext
(
"Attempting bind to"
)
.
" "
.
$authserver
.
"</td>"
;
if
(
ldap_test_bind
(
$authcfg
))
{
echo
"<td><font color='green'>OK</font></td></tr>"
;
echo
"<tr><td>"
.
gettext
(
"Attempting to fetch Organizational Units from"
)
.
" "
.
$authserver
.
"</td>"
;
echo
"<tr><td>"
.
gettext
(
"Attempting to fetch Organizational Units from"
)
.
" "
.
$authserver
.
"</td>"
;
$ous
=
ldap_get_user_ous
(
true
,
$authcfg
);
$ous
=
$ldap_auth
->
listOUs
(
);
if
(
count
(
$ous
)
>
1
)
{
if
(
count
(
$ous
)
>
1
)
{
echo
"<td><font color=green>OK</font></td></tr>"
;
echo
"<td><font color=green>OK</font></td></tr>"
;
if
(
is_array
(
$ous
))
{
echo
"<tr><td>"
.
gettext
(
"Organization units found"
)
.
"</td><td><font color=green>"
.
count
(
$ous
)
.
"</font></td></tr>"
;
echo
"<tr><td colspan='2'>"
.
gettext
(
"Organization units found"
)
.
"</td></tr>"
;
foreach
(
$ous
as
$ou
)
{
foreach
(
$ous
as
$ou
)
{
echo
"<tr><td colspan='2'>"
.
$ou
.
"</td></tr>"
;
echo
"<tr><td colspan='2'>"
.
$ou
.
"</td></tr>"
;
}
}
}
}
else
{
}
else
{
echo
"<td><font color='red'>"
.
gettext
(
"failed"
)
.
"</font></td></tr>"
;
echo
"<td><font color='red'>"
.
gettext
(
"failed"
)
.
"</font></td></tr>"
;
}
}
}
else
{
}
else
{
echo
"<td><font color='red'>"
.
gettext
(
"failed"
)
.
"</font></td></tr>"
;
echo
"<td><font color='red'>"
.
gettext
(
"failed"
)
.
"</font></td></tr>"
;
}
}
}
else
{
echo
"<td><font color='red'>"
.
gettext
(
"failed"
)
.
"</font></td></tr>"
;
}
}
}
?>
?>
...
...
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