From 939771aa158e4b70a939871f147fdce28f33c2bb Mon Sep 17 00:00:00 2001 From: odain Date: Thu, 23 Feb 2023 16:29:45 +0100 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B06022=20-=20Make=20synchro=20scripts?= =?UTF-8?q?=20work=20by=20http=20via=20token=20authentication=20with=20SYN?= =?UTF-8?q?CHRO=20scopes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- synchro/synchro_exec.php | 7 +++++-- synchro/synchro_import.php | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/synchro/synchro_exec.php b/synchro/synchro_exec.php index 46f5f11ab..ba0f901ae 100644 --- a/synchro/synchro_exec.php +++ b/synchro/synchro_exec.php @@ -46,7 +46,7 @@ function UsageAndExit($oP) } else { - $oP->p("The parameter 'data_sources' is mandatory, and must contain a comma separated list of data sources\n"); + $oP->p("The parameter 'data_sources' is mandatory, and must contain a comma separated list of data sources\n"); } $oP->output(); exit -2; @@ -105,6 +105,9 @@ if (utils::IsModeCLI()) else { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); + + //N°6022 - Make synchro scripts work by http via token authentication with SYNCHRO scopes + $oCtx = new ContextTag(ContextTag::TAG_SYNCHRO); LoginWebPage::DoLogin(); // Check user rights and prompt if needed } @@ -166,7 +169,7 @@ foreach(explode(',', $sDataSourcesList) as $iSDS) } catch(Exception $e) { - $oP->add($e->getMessage()); + $oP->add($e->getMessage()); if ($bSimulate) { CMDBSource::Query('ROLLBACK'); diff --git a/synchro/synchro_import.php b/synchro/synchro_import.php index 9ece8bc64..935d824de 100644 --- a/synchro/synchro_import.php +++ b/synchro/synchro_import.php @@ -255,7 +255,7 @@ if (utils::IsModeCLI()) { // Next steps: // specific arguments: 'csvfile' - // + // $sAuthUser = ReadMandatoryParam($oP, 'auth_user', 'raw_data'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd', 'raw_data'); $sCsvFile = ReadMandatoryParam($oP, 'csvfile', 'raw_data'); @@ -282,6 +282,9 @@ if (utils::IsModeCLI()) else { require_once APPROOT.'/application/loginwebpage.class.inc.php'; + + //N°6022 - Make synchro scripts work by http via token authentication with SYNCHRO scopes + $oCtx = new ContextTag(ContextTag::TAG_SYNCHRO); LoginWebPage::DoLogin(); // Check user rights and prompt if needed $sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data'); From bfe55183d0b42fd776dfc8273215c913bcbfca75 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 27 Feb 2023 15:09:49 +0100 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06023=20Fix=20error=20log=20Thanks=20?= =?UTF-8?q?@Hipska=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/htmlsanitizer.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/htmlsanitizer.class.inc.php b/core/htmlsanitizer.class.inc.php index 2f9f44280..08d2eeb63 100644 --- a/core/htmlsanitizer.class.inc.php +++ b/core/htmlsanitizer.class.inc.php @@ -44,7 +44,7 @@ abstract class HTMLSanitizer { $sSanitizerClass = utils::GetConfig()->Get($sConfigKey); if (!class_exists($sSanitizerClass)) { - IssueLog::Warning('The configured "html_sanitizer" class "'.$sSanitizerClass.'" is not a valid class. Will use HTMLDOMSanitizer as the default sanitizer.'); + IssueLog::Warning('The configured "'.$sConfigKey.'" class "'.$sSanitizerClass.'" is not a valid class. Will use HTMLDOMSanitizer as the default sanitizer.'); $sSanitizerClass = 'HTMLDOMSanitizer'; } else if (!is_subclass_of($sSanitizerClass, 'HTMLSanitizer')) { if ($sConfigKey === 'html_sanitizer') {