set ssl variables also when session not yet exists

This commit is contained in:
Roland Gruber 2017-11-19 10:31:26 +01:00
parent d0f6befa7e
commit 7654fdfd3c
1 changed files with 11 additions and 6 deletions

View File

@ -44,14 +44,19 @@ include_once '2factor.inc';
* Sets the environment variables for custom SSL CA certificates.
*/
function setSSLCaCert() {
// set SSL certificate if set
$config = null;
if (isset($_SESSION['cfgMain'])) {
$sslCaPath = $_SESSION['cfgMain']->getSSLCaCertPath();
$config = $_SESSION['cfgMain'];
}
else {
$config = new LAMCfgMain();
}
// set SSL certificate if set
$sslCaPath = $config->getSSLCaCertPath();
if ($sslCaPath != null) {
putenv('LDAPTLS_CACERT=' . $sslCaPath);
putenv('TLS_CACERT=' . $sslCaPath);
}
}
}
/**