Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
centreon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
centreon
Commits
b71a3e88
Commit
b71a3e88
authored
May 12, 2017
by
loiclau
Browse files
Options
Downloads
Patches
Plain Diff
* Fix ldap connection, typo in function name #5216
* Remove special chars filter for POST data
parent
fd359770
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
www/class/centreonLDAP.class.php
+12
-5
12 additions, 5 deletions
www/class/centreonLDAP.class.php
www/include/configuration/configObject/contact/ldapsearch.php
+8
-2
8 additions, 2 deletions
...include/configuration/configObject/contact/ldapsearch.php
www/main.php
+0
-5
0 additions, 5 deletions
www/main.php
with
20 additions
and
12 deletions
www/class/centreonLDAP.class.php
+
12
−
5
View file @
b71a3e88
...
...
@@ -192,6 +192,7 @@ class CentreonLDAP {
*/
public
function
connect
()
{
foreach
(
$this
->
_ldapHosts
as
$ldap
)
{
$port
=
""
;
$testingPort
=
389
;
...
...
@@ -204,8 +205,9 @@ class CentreonLDAP {
}
else
{
$url
=
'ldap://'
.
$ldap
[
'host'
]
.
$port
.
'/'
;
}
$this
->
debug
(
"LDAP Connect : trying url : "
.
$url
);
$this
->
setErrorHandler
();
$this
->
_debug
(
"LDAP Connect : trying url : "
.
$url
);
$this
->
_setErrorHandler
();
if
(
$this
->
isLdapServerAvailable
(
$ldap
[
'host'
],
$testingPort
,
$ldap
[
'search_timeout'
]))
{
$this
->
_ds
=
ldap_connect
(
$url
);
...
...
@@ -216,7 +218,7 @@ class CentreonLDAP {
}
ldap_set_option
(
$this
->
_ds
,
LDAP_OPT_PROTOCOL_VERSION
,
$protocol_version
);
if
(
isset
(
$ldap
[
'info'
][
'use_tls'
])
&&
$ldap
[
'info'
][
'use_tls'
]
==
1
)
{
$this
->
debug
(
"LDAP Connect : use tls"
);
$this
->
_
debug
(
"LDAP Connect : use tls"
);
@
ldap_start_tls
(
$this
->
_ds
);
}
restore_error_handler
();
...
...
@@ -226,7 +228,7 @@ class CentreonLDAP {
return
true
;
}
}
$this
->
debug
(
"LDAP Connect : connection error"
);
$this
->
_
debug
(
"LDAP Connect : connection error"
);
}
return
false
;
}
...
...
@@ -321,8 +323,10 @@ class CentreonLDAP {
if
(
trim
(
$this
->
_userSearchInfo
[
'filter'
])
==
''
)
{
return
false
;
}
$this
->
_setErrorHandler
();
//
$this->_setErrorHandler();
$filter
=
preg_replace
(
'/%s/'
,
$this
->
replaceFilter
(
$username
),
$this
->
_userSearchInfo
[
'filter'
]);
$result
=
ldap_search
(
$this
->
_ds
,
$this
->
_userSearchInfo
[
'base_search'
],
$filter
);
$entries
=
ldap_get_entries
(
$this
->
_ds
,
$result
);
restore_error_handler
();
...
...
@@ -342,6 +346,9 @@ class CentreonLDAP {
if
(
trim
(
$this
->
_groupSearchInfo
[
'filter'
])
==
''
)
{
return
false
;
}
var_dump
(
$this
->
_groupSearchInfo
[
'filter'
]);
$this
->
_setErrorHandler
();
$filter
=
preg_replace
(
'/%s/'
,
$this
->
replaceFilter
(
$group
),
$this
->
_groupSearchInfo
[
'filter'
]);
$result
=
ldap_search
(
$this
->
_ds
,
$this
->
_groupSearchInfo
[
'base_search'
],
$filter
);
...
...
This diff is collapsed.
Click to expand it.
www/include/configuration/configObject/contact/ldapsearch.php
+
8
−
2
View file @
b71a3e88
...
...
@@ -89,6 +89,7 @@ $queryGetLdap = 'SELECT contact_alias
WHERE contact_register = 1'
;
$res
=
$pearDB
->
query
(
$queryGetLdap
);
$listLdapUsers
=
array
();
if
(
!
PEAR
::
isError
(
$res
))
{
while
(
$row
=
$res
->
fetchRow
())
{
$listLdapUsers
[]
=
$row
[
'contact_alias'
];
...
...
@@ -101,7 +102,10 @@ $buffer->startElement("reponse");
$ids
=
explode
(
","
,
$confList
);
foreach
(
$ids
as
$arId
)
{
$ldap
=
new
CentreonLDAP
(
$pearDB
,
null
,
$arId
);
$connect
=
false
;
if
(
$ldap
->
connect
())
{
$connect
=
true
;
...
...
@@ -116,7 +120,7 @@ foreach ($ids as $arId) {
FROM auth_ressource_info
WHERE ar_id = ?"
;
$stmt
=
$pearDB
->
prepare
(
$query
);
$res
=
$pearDB
->
execute
(
$stmt
,
array
(
$arId
));
$res
=
$pearDB
->
execute
(
$stmt
,
array
(
(
int
)
$arId
));
while
(
$row
=
$res
->
fetchRow
())
{
switch
(
$row
[
'ari_name'
])
{
...
...
@@ -143,6 +147,7 @@ foreach ($ids as $arId) {
$searchResult
=
$ldap
->
search
(
$ldap_search_filter
,
$ldap_base_dn
,
$ldap_search_limit
,
$ldap_search_timeout
);
$number_returned
=
count
(
$searchResult
);
if
(
$number_returned
)
{
$buffer
->
writeElement
(
"entries"
,
$number_returned
);
for
(
$i
=
0
;
$i
<
$number_returned
;
$i
++
)
{
...
...
@@ -217,6 +222,7 @@ foreach ($ids as $arId) {
}
}
}
if
(
isset
(
$error
))
{
$buffer
->
writeElement
(
"error"
,
$error
);
}
...
...
This diff is collapsed.
Click to expand it.
www/main.php
+
0
−
5
View file @
b71a3e88
...
...
@@ -44,11 +44,6 @@
* Purge Values
*/
if
(
function_exists
(
'filter_var'
)){
foreach
(
$_POST
as
$key
=>
$value
){
if
(
!
is_array
(
$value
)){
$_POST
[
$key
]
=
filter_var
(
$value
,
FILTER_SANITIZE_SPECIAL_CHARS
);
}
}
foreach
(
$_GET
as
$key
=>
$value
){
if
(
!
is_array
(
$value
)){
$_GET
[
$key
]
=
filter_var
(
$value
,
FILTER_SANITIZE_SPECIAL_CHARS
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment