bernd
Erkenne automatisch vom browser generiertes Zertifikat nicht an
bernd commited b8975d4 at 2009-06-08 14:48:24
<?php
require_once('../config.php');
global $prefix;
$prefix = '../';
// Das Parent-Verzeichnis in den Include-Pfad, da wir uns jetzt in einem anderen Verzeichnis befinden.
ini_set('include_path', ini_get('include_path').':../');
require_once('session/start.php');
require_once('inc/base.php');
require_once('inc/debug.php');
require_once('inc/error.php');
function prepare_cert($cert)
{
return str_replace(array('-----BEGIN CERTIFICATE-----', '-----END CERTIFICATE-----', ' ', "\n"), array(), $cert);
}
function get_logins_by_cert($cert)
{
$cert = mysql_real_escape_string(prepare_cert($cert));
$query = "SELECT type,username,startpage FROM system.clientcert WHERE cert='{$cert}'";
$result = db_query($query);
if (mysql_num_rows($result) < 1)
return NULL;
else {
$ret = array();
while ($row = mysql_fetch_assoc($result)) {
$ret[] = $row;
}
return $ret;
}
}
DEBUG($_ENV);
if ($_SESSION['role'] != ROLE_ANONYMOUS && isset($_REQUEST['record']) && isset($_REQUEST['backto']) && check_path($_REQUEST['backto']))
{
DEBUG('recording client-cert');
if (isset($_ENV['REDIRECT_SSL_CLIENT_CERT']) && $_ENV['REDIRECT_SSL_CLIENT_S_DN'] != '' && $_ENV['REDIRECT_SSL_CLIENT_I_DN'] != '')
{
$_SESSION['clientcert_cert'] = prepare_cert($_ENV['REDIRECT_SSL_CLIENT_CERT']);
$_SESSION['clientcert_dn'] = $_ENV['REDIRECT_SSL_CLIENT_S_DN'];
$_SESSION['clientcert_issuer'] = $_ENV['REDIRECT_SSL_CLIENT_I_DN'];
header('Location: '.$prefix.$_REQUEST['backto'].encode_querystring(''));
die();
}
else
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX