Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
58b46f6f
Commit
58b46f6f
authored
Apr 20, 2017
by
Côme Chilliet
Browse files
Fixes
#5483
Removed uses of "+" as an attribute asked in ldapsearch as it seems openldap specific
Also removed get_root_dse unused method
parent
57ee7e5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/class_ldap.inc
View file @
58b46f6f
...
...
@@ -1346,53 +1346,21 @@ class LDAP
}
}
function
get_naming_contexts
(
$server
,
$admin
=
""
,
$password
=
""
)
function
get_naming_contexts
(
$server
,
$admin
=
''
,
$password
=
''
)
{
/* Build LDAP connection */
$ds
=
ldap_connect
(
$server
);
if
(
!
$ds
)
{
die
(
"
Can't bind to LDAP. No check possible!
"
);
die
(
'
Can
\
't bind to LDAP. No check possible!
'
);
}
ldap_set_option
(
$ds
,
LDAP_OPT_PROTOCOL_VERSION
,
3
);
ldap_bind
(
$ds
,
$admin
,
$password
);
/* Get base to look for naming contexts */
$sr
=
@
ldap_read
(
$ds
,
""
,
"
objectClass=*
"
,
array
(
"+"
));
$sr
=
@
ldap_read
(
$ds
,
''
,
'
objectClass=*
'
,
array
(
'namingContexts'
));
$attr
=
@
ldap_get_entries
(
$ds
,
$sr
);
return
$attr
[
0
][
'namingcontexts'
];
}
function
get_root_dse
(
$server
,
$admin
=
""
,
$password
=
""
)
{
/* Build LDAP connection */
$ds
=
ldap_connect
(
$server
);
if
(
!
$ds
)
{
die
(
"Can't bind to LDAP. No check possible!"
);
}
ldap_set_option
(
$ds
,
LDAP_OPT_PROTOCOL_VERSION
,
3
);
ldap_bind
(
$ds
,
$admin
,
$password
);
/* Get base to look for naming contexts */
$sr
=
@
ldap_read
(
$ds
,
""
,
"objectClass=*"
,
array
(
"+"
));
$attr
=
@
ldap_get_entries
(
$ds
,
$sr
);
/* Return empty array, if nothing was set */
if
(
!
isset
(
$attr
[
0
]))
{
return
array
();
}
/* Rework array... */
$result
=
array
();
for
(
$i
=
0
;
$i
<
$attr
[
0
][
'count'
];
$i
++
)
{
$result
[
$attr
[
0
][
$i
]]
=
$attr
[
0
][
$attr
[
0
][
$i
]];
unset
(
$result
[
$attr
[
0
][
$i
]][
'count'
]);
}
return
$result
;
}
}
?>
Write
Preview
Supports
Markdown
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