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
780c95a3
Commit
780c95a3
authored
Jul 28, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy/ldap) work in progress ldap replace
parent
d12e8a14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
system_usermanager_settings_ldapacpicker.php
src/www/system_usermanager_settings_ldapacpicker.php
+21
-13
system_usermanager_settings_test.php
src/www/system_usermanager_settings_test.php
+1
-1
No files found.
src/www/system_usermanager_settings_ldapacpicker.php
View file @
780c95a3
...
@@ -32,21 +32,29 @@ include('head.inc');
...
@@ -32,21 +32,29 @@ include('head.inc');
$ous
=
array
();
$ous
=
array
();
if
(
$_GET
)
{
if
(
isset
(
$_GET
[
'basedn'
])
&&
isset
(
$_GET
[
'host'
])
)
{
$authcfg
=
array
();
$authcfg
=
array
();
$authcfg
[
'ldap_port'
]
=
isset
(
$_GET
[
'port'
])
?
$_GET
[
'port'
]
:
null
;
$authcfg
[
'ldap_basedn'
]
=
isset
(
$_GET
[
'basedn'
])
?
$_GET
[
'basedn'
]
:
null
;
$authcfg
[
'host'
]
=
isset
(
$_GET
[
'basedn'
])
?
$_GET
[
'host'
]
:
null
;
$authcfg
[
'ldap_scope'
]
=
isset
(
$_GET
[
'scope'
])
?
$_GET
[
'scope'
]
:
null
;
$authcfg
[
'ldap_binddn'
]
=
isset
(
$_GET
[
'binddn'
])
?
$_GET
[
'binddn'
]
:
null
;
$authcfg
[
'ldap_bindpw'
]
=
isset
(
$_GET
[
'bindpw'
])
?
$_GET
[
'bindpw'
]
:
null
;
$authcfg
[
'ldap_urltype'
]
=
isset
(
$_GET
[
'urltype'
])
?
$_GET
[
'urltype'
]
:
null
;
$authcfg
[
'ldap_protver'
]
=
isset
(
$_GET
[
'proto'
])
?
$_GET
[
'proto'
]
:
null
;
$authcfg
[
'ldap_authcn'
]
=
isset
(
$_GET
[
'authcn'
])
?
explode
(
";"
,
$_GET
[
'authcn'
])
:
array
();
$authcfg
[
'ldap_caref'
]
=
isset
(
$_GET
[
'cert'
])
?
$_GET
[
'cert'
]
:
null
;
$authcfg
[
'ldap_caref'
]
=
isset
(
$_GET
[
'cert'
])
?
$_GET
[
'cert'
]
:
null
;
$ldap_auth
=
new
OPNsense\Auth\LDAP
(
$authcfg
[
'ldap_basedn'
]);
ldap_setup_caenv
(
$authcfg
);
ldap_setup_caenv
(
$authcfg
);
$ldap_is_connected
=
$ldap_auth
->
connect
(
$authcfg
[
'ldap_full_url'
],
$authcfg
[
'ldap_binddn'
],
$authcfg
[
'ldap_bindpw'
]);
$ldap_authcn
=
isset
(
$_GET
[
'authcn'
])
?
explode
(
";"
,
$_GET
[
'authcn'
])
:
array
();
if
(
isset
(
$_GET
[
'urltype'
])
&&
strstr
(
$_GET
[
'urltype'
],
"Standard"
))
{
$ldap_full_url
=
"ldap://"
;
}
else
{
$ldap_full_url
=
"ldaps://"
;
}
$ldap_full_url
.=
is_ipaddrv6
(
$_GET
[
'host'
])
?
"[
{
$_GET
[
'host'
]
}
]"
:
$_GET
[
'host'
];
if
(
!
empty
(
$_GET
[
'port'
]))
{
$ldap_full_url
.=
":
{
$_GET
[
'port'
]
}
"
;
}
$ldap_auth
=
new
OPNsense\Auth\LDAP
(
$_GET
[
'basedn'
]
,
isset
(
$_GET
[
'proto'
])
?
$_GET
[
'proto'
]
:
3
);
$ldap_is_connected
=
$ldap_auth
->
connect
(
$ldap_full_url
,
!
empty
(
$_GET
[
'binddn'
])
?
$_GET
[
'binddn'
]
:
null
,
!
empty
(
$_GET
[
'bindpw'
])
?
$_GET
[
'bindpw'
]
:
null
);
if
(
$ldap_is_connected
)
{
if
(
$ldap_is_connected
)
{
$ous
=
$ldap_auth
->
listOUs
();
$ous
=
$ldap_auth
->
listOUs
();
}
}
...
@@ -85,7 +93,7 @@ else :
...
@@ -85,7 +93,7 @@ else :
<?php
<?php
if
(
is_array
(
$ous
))
{
if
(
is_array
(
$ous
))
{
foreach
(
$ous
as
$ou
)
{
foreach
(
$ous
as
$ou
)
{
if
(
in_array
(
$ou
,
$
authcfg
[
'ldap_authcn'
]
))
{
if
(
in_array
(
$ou
,
$
ldap_authcn
))
{
$CHECKED
=
" CHECKED"
;
$CHECKED
=
" CHECKED"
;
}
else
{
}
else
{
$CHECKED
=
""
;
$CHECKED
=
""
;
...
...
src/www/system_usermanager_settings_test.php
View file @
780c95a3
...
@@ -36,7 +36,7 @@ if (isset($config['system']['authserver'][0]['host'])) {
...
@@ -36,7 +36,7 @@ if (isset($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_auth
=
new
OPNsense\Auth\LDAP
(
$authcfg
[
'ldap_basedn'
]
,
$authcfg
[
'ldap_protver'
]
);
ldap_setup_caenv
(
$authcfg
);
ldap_setup_caenv
(
$authcfg
);
$ldap_is_connected
=
$ldap_auth
->
connect
(
$authcfg
[
'ldap_full_url'
],
$authcfg
[
'ldap_binddn'
],
$authcfg
[
'ldap_bindpw'
]);
$ldap_is_connected
=
$ldap_auth
->
connect
(
$authcfg
[
'ldap_full_url'
],
$authcfg
[
'ldap_binddn'
],
$authcfg
[
'ldap_bindpw'
]);
}
}
...
...
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