Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Fix security fix by deleting unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
callapa committed Oct 18, 2019
1 parent 23f06f1 commit 71aeffc
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 649 deletions.
9 changes: 4 additions & 5 deletions www/include/Administration/parameters/ldap/form.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/*
* Copyright 2005-2019 Centreon
* Centreon is developed by : Julien Mathis and Romain Le Merlus under
Expand Down Expand Up @@ -84,15 +83,15 @@
null,
_("Yes"),
'1',
array('id' => 'ldap_srv_dns_y', 'onclick' => "toggleParams(false, false);")
array('id' => 'ldap_srv_dns_y', 'onclick' => "toggleParams(false);")
);
$ldapUseDns[] = $form->createElement(
'radio',
'ldap_srv_dns',
null,
_("No"),
'0',
array('id' => 'ldap_srv_dns_n', 'onclick' => "toggleParams(true, false);")
array('id' => 'ldap_srv_dns_n', 'onclick' => "toggleParams(true);")
);
$form->addGroup($ldapUseDns, 'ldap_srv_dns', _("Use service DNS"), '&nbsp;');

Expand All @@ -112,15 +111,15 @@
null,
_("Yes"),
'1',
array('id' => 'ldap_auto_sync_y', 'onclick' => "toggleParamSync(false, false);")
array('id' => 'ldap_auto_sync_y', 'onclick' => "toggleParamSync(false);")
);
$ldapAutoScan[] = $form->createElement(
'radio',
'ldap_auto_sync',
null,
_("No"),
'0',
array('id' => 'ldap_auto_sync_n', 'onclick' => "toggleParamSync(true, false);")
array('id' => 'ldap_auto_sync_n', 'onclick' => "toggleParamSync(true);")
);
$form->addGroup($ldapAutoScan, 'ldap_auto_sync', _("Enable LDAP synchronization on login"), '&nbsp;');
// default interval before re-scanning the whole LDAP. By default, a duration of one hour is set
Expand Down
144 changes: 21 additions & 123 deletions www/include/Administration/parameters/ldap/javascript/ldapJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,62 +31,20 @@
*
* For more information : [email protected]
*
* SVN : $URL$
* SVN : $Id$
*
*/
?>
<script type="text/javascript">
function mk_pagination() {
}
function mk_paginationFF() {
}
function set_header_title() {
}

var nextRowId;
var counter = '<?php echo $maxHostId;?>';
var nbOfInitialRows = '<?php echo $nbOfInitialRows; ?>';
var o = '<?php echo $o;?>';
var arId = '<?php echo $arId;?>';
var templates;

/*
* Transform our div
*/
function transformForm() {
var params;
var proc;
var addrXML;
var addrXSL;
function mk_pagination() {}
function mk_paginationFF() {}
function set_header_title() {}

//var params = '?sid=' + sid;

if (o == 'w' || o == 'ldap') {
params = '?arId=' + arId;
proc = new Transformation();
addrXML = './include/options/oreon/generalOpt/ldap/xml/ldap_host.php' + params;
addrXSL = './include/options/oreon/generalOpt/ldap/xsl/ldap_host.xsl';
proc.setXml(addrXML);
proc.setXslt(addrXSL);
proc.transform("dynamicDiv");
o = 0;
} else {
params = '?id=' + counter + '&nbOfInitialRows=' + nbOfInitialRows;
proc = new Transformation();
addrXML = './include/options/oreon/generalOpt/ldap/xml/additionalRowXml.php' + params;
addrXSL = './include/options/oreon/generalOpt/ldap/xsl/additionalRow.xsl';
proc.setXml(addrXML);
proc.setXslt(addrXSL);
proc.transform(nextRowId);
}
}
let ldapTemplates = [];

/*
* called when the use _dns is to set at no is clicked
*/
function toggleParams(checkValue, isInit) {
if (checkValue == true) {
function toggleParams(checkValue) {
if (checkValue === true) {
jQuery('#ldap_dns_use_ssl').fadeOut({duration: 0});
jQuery('#ldap_dns_use_tls').fadeOut({duration: 0});
jQuery('#ldap_dns_use_domain').fadeOut({duration: 0});
Expand All @@ -110,65 +68,30 @@ function toggleParams(checkValue, isInit) {
/*
* called when LDAP is enabled or not
*/
function toggleParamSync(checkValue, isInit) {
if (checkValue == true) {
function toggleParamSync(checkValue) {
if (checkValue === true) {
jQuery('#ldap_sync_interval').fadeOut({duration: 0});
} else {
jQuery('#ldap_sync_interval').fadeIn({duration: 0});
}
}

/**
* Display or hide custom options
*/
function toggleCustom(select) {
if (typeof(select) == 'undefined' || typeof(select.selectedIndex) == 'undefined') {
return null;
}
value = select.options[select.selectedIndex].value;
if (value == 0) {
jQuery('#ldap_user_filter').fadeIn({duration: 0});
jQuery('#ldap_user_uid_attr').fadeIn({duration: 0});
jQuery('#ldap_user_group').fadeIn({duration: 0});
jQuery('#ldap_user_name').fadeIn({duration: 0});
jQuery('#ldap_user_firstname').fadeIn({duration: 0});
jQuery('#ldap_user_lastname').fadeIn({duration: 0});
jQuery('#ldap_user_email').fadeIn({duration: 0});
jQuery('#ldap_user_pager').fadeIn({duration: 0});
jQuery('#ldap_group_filter').fadeIn({duration: 0});
jQuery('#ldap_group_gid_attr').fadeIn({duration: 0});
jQuery('#ldap_group_member').fadeIn({duration: 0});
} else {
jQuery('#ldap_user_filter').fadeOut({duration: 0});
jQuery('#ldap_user_uid_attr').fadeOut({duration: 0});
jQuery('#ldap_user_group').fadeOut({duration: 0});
jQuery('#ldap_user_name').fadeOut({duration: 0});
jQuery('#ldap_user_firstname').fadeOut({duration: 0});
jQuery('#ldap_user_lastname').fadeOut({duration: 0});
jQuery('#ldap_user_email').fadeOut({duration: 0});
jQuery('#ldap_user_pager').fadeOut({duration: 0});
jQuery('#ldap_group_filter').fadeOut({duration: 0});
jQuery('#ldap_group_gid_attr').fadeOut({duration: 0});
jQuery('#ldap_group_member').fadeOut({duration: 0});
}
}

/*
* Initialises advanced parameters
*/
function initParams() {
initTemplates();
let noDns = false;
if (document.getElementById('ldap_srv_dns_n')) {
var noDns = false;
if (document.getElementById('ldap_srv_dns_n').type == 'radio') {
if (document.getElementById('ldap_srv_dns_n').type === 'radio') {
if (document.getElementById('ldap_srv_dns_n').checked) {
noDns = true;
}
}
}
// getting saved synchronization interval's time field state
var loginSync = false;
var loginCheckbox = document.getElementById('ldap_auto_sync_n')
let loginSync = false;
let loginCheckbox = document.getElementById('ldap_auto_sync_n');
if (loginCheckbox
&& loginCheckbox.type === 'radio'
&& loginCheckbox.checked
Expand All @@ -177,41 +100,17 @@ function initParams() {
}

// displaying or hiding toggling fields
toggleParams(noDns, true);
toggleParamSync(loginSync, true);
}

/*
* Function is called when the '+' button is pressed
*/
function addNewHost() {
nbOfInitialRows++;
nextRowId = 'additionalRow_' + nbOfInitialRows;
transformForm();
counter++;
}

/*
* function that is called when the 'x' button is pressed
*/
function removeTr(trId) {
if (document.getElementById(trId)) {
if (navigator.appName == "Microsoft Internet Explorer") {
document.getElementById(trId).innerText = "";
} else {
document.getElementById(trId).innerHTML = "";
}
jQuery('#'+trId).fadeOut({duration: 0});
}
toggleParams(noDns);
toggleParamSync(loginSync);
}

/*
* Initializes templates
*/
function initTemplates() {
ldapTemplates = new Array();
ldapTemplates = [];

ldapTemplates['Active Directory'] = new Array();
ldapTemplates['Active Directory'] = [];
ldapTemplates['Active Directory']['user_filter'] =
'(&(samAccountName=%s)(objectClass=user)(samAccountType=805306368))';
ldapTemplates['Active Directory']['alias'] = 'samaccountname';
Expand All @@ -226,7 +125,7 @@ function initTemplates() {
ldapTemplates['Active Directory']['group_name'] = 'samaccountname';
ldapTemplates['Active Directory']['group_member'] = 'member';

ldapTemplates['Posix'] = new Array();
ldapTemplates['Posix'] = [];
ldapTemplates['Posix']['user_filter'] = '(&(uid=%s)(objectClass=inetOrgPerson))';
ldapTemplates['Posix']['alias'] = 'uid';
ldapTemplates['Posix']['user_group'] = '';
Expand All @@ -239,7 +138,7 @@ function initTemplates() {
ldapTemplates['Posix']['group_name'] = 'cn';
ldapTemplates['Posix']['group_member'] = 'member';

ldapTemplates['Okta'] = new Array();
ldapTemplates['Okta'] = [];
ldapTemplates['Okta']['user_filter'] = '(&(nickName=%s)(objectclass=inetorgperson))';
ldapTemplates['Okta']['alias'] = 'nickname';
ldapTemplates['Okta']['user_group'] = 'memberof';
Expand All @@ -259,10 +158,9 @@ function initTemplates() {
function applyTemplate(templateValue) {

jQuery('input[type^=text]').each(function (index, el) {
key = el.getAttribute('name');
var attr = key;
if (typeof(ldapTemplates[templateValue]) != 'undefined') {
if (typeof(ldapTemplates[templateValue][attr]) != 'undefined') {
let attr = el.getAttribute('name');
if (typeof(ldapTemplates[templateValue]) !== 'undefined') {
if (typeof(ldapTemplates[templateValue][attr]) !== 'undefined') {
el.value = ldapTemplates[templateValue][attr];
}
}
Expand Down
Loading

0 comments on commit 71aeffc

Please sign in to comment.