Merged in release/3.8.0 (pull request #8620)

Updating develop branch with last changes in release/3.8.0, issues with plugins, second part
This commit is contained in:
Julio Cesar Laura Avendaño
2022-10-21 18:03:29 +00:00
4 changed files with 43 additions and 24 deletions

View File

@@ -511,6 +511,10 @@ class LdapAdvanced
{
$pass = explode("_", $aAuthSource["AUTH_SOURCE_PASSWORD"]);
// Removing sensitive data
$loggableAuthSource = $aAuthSource;
unset($loggableAuthSource["AUTH_SOURCE_PASSWORD"]);
foreach ($pass as $index => $value) {
if ($value == "2NnV3ujj3w") {
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0], $aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
@@ -518,18 +522,18 @@ class LdapAdvanced
}
$ldapcnn = ldap_connect($aAuthSource['AUTH_SOURCE_SERVER_NAME'], $aAuthSource['AUTH_SOURCE_PORT']);
$this->stdLog($ldapcnn, "ldap_connect", $aAuthSource);
$this->stdLog($ldapcnn, "ldap_connect", $loggableAuthSource);
$ldapServer = $aAuthSource["AUTH_SOURCE_SERVER_NAME"] . ":" . $aAuthSource["AUTH_SOURCE_PORT"];
ldap_set_option($ldapcnn, LDAP_OPT_PROTOCOL_VERSION, 3);
$this->stdLog($ldapcnn, "ldap_set_option", $aAuthSource);
$this->stdLog($ldapcnn, "ldap_set_option", $loggableAuthSource);
ldap_set_option($ldapcnn, LDAP_OPT_REFERRALS, 0);
$this->stdLog($ldapcnn, "ldap_set_option", $aAuthSource);
$this->stdLog($ldapcnn, "ldap_set_option", $loggableAuthSource);
if (isset($aAuthSource["AUTH_SOURCE_ENABLED_TLS"]) && $aAuthSource["AUTH_SOURCE_ENABLED_TLS"]) {
$resultLDAPStartTLS = @ldap_start_tls($ldapcnn);
$this->stdLog($ldapcnn, "ldap_start_tls", $aAuthSource);
$this->stdLog($ldapcnn, "ldap_start_tls", $loggableAuthSource);
$ldapServer = "TLS " . $ldapServer;
}
@@ -538,9 +542,9 @@ class LdapAdvanced
$this->log($ldapcnn, "bind $ldapServer like anonymous user");
} else {
$bBind = @ldap_bind($ldapcnn, $aAuthSource['AUTH_SOURCE_SEARCH_USER'], $aAuthSource['AUTH_SOURCE_PASSWORD']);
$this->log($ldapcnn, "bind $ldapServer with user " . $aAuthSource["AUTH_SOURCE_SEARCH_USER"]);
$this->log($ldapcnn, "bind $ldapServer with user " . $loggableAuthSource["AUTH_SOURCE_SEARCH_USER"]);
}
$this->stdLog($ldapcnn, "ldap_bind", $aAuthSource);
$this->stdLog($ldapcnn, "ldap_bind", $loggableAuthSource);
$this->getDiagnosticMessage($ldapcnn);
if (!$bBind) {
throw new Exception("Unable to bind to server: $ldapServer . " . "LDAP-Errno: " . ldap_errno($ldapcnn) . " : " . ldap_error($ldapcnn) . " \n");

View File

@@ -449,18 +449,23 @@ class adminProxy extends HttpProxyController
$this->msg = $this->result ? '' : $Server->error;
break;
case 3: //try to connect to host
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
} else {
$host = $srv;
try {
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
} else {
$server = $srv;
}
$tls = (strtoupper($SMTPSecure) === 'TLS');
$ssl = (strtoupper($SMTPSecure) === 'SSL');
$this->success = $smtp->Connect(($ssl ? 'ssl://':'') . $server, $port, $timeout);
$this->msg = $this->result ? '' : $Server->error;
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
$tls = (strtoupper($SMTPSecure) == 'tls');
$ssl = (strtoupper($SMTPSecure) == 'ssl');
$this->success = $smtp->Connect(($ssl ? 'ssl://':'').$server, $port, $timeout);
$this->msg = $this->result ? '' : $Server->error;
break;
case 4: //try login to host
if ($auth_required == 'true') {

View File

@@ -2,13 +2,13 @@
namespace ProcessMaker\BusinessModel\Files;
use Chumper\Zipper\Zipper;
use Configurations;
use Exception;
use G;
use ProcessMaker\Core\System;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
use ZipArchive;
class FilesLogs extends Files
{
@@ -227,13 +227,13 @@ class FilesLogs extends Files
private function createZip($files)
{
try {
$zipper = new Zipper();
$zipper = new ZipArchive();
$name = str_replace('.log', '.zip', $files[0]);
if (count($files) > 1) {
$name = 'processmaker_logs.zip';
}
$zipper->zip($this->getPathDataSaveFile() . $name);
$zipper->open($this->getPathDataSaveFile() . $name, ZipArchive::CREATE);
$pathFileLogs = $this->getPathFiles();
$pathSep = '/';
@@ -247,7 +247,7 @@ class FilesLogs extends Files
foreach ($files as $key => $file) {
$info = pathinfo($file);
if (file_exists($pathFileLogs . $info['basename'])) {
$zipper->add($pathFileLogs . $info['basename']);
$zipper->addFile($pathFileLogs . $info['basename'], $info['basename']);
}
}
$zipper->close();