More formatting

This commit is contained in:
John Crisp
2021-03-07 18:57:17 +01:00
parent d95ee329f5
commit 3b02db3a27

View File

@@ -322,7 +322,7 @@ function CAdb_get_entry($serial)
{
global $config;
$regexp = "^[VR]\t.*\t.*\t$serial\t.*\t.*$";
$x = exec('egrep '.escshellarg($regexp).' '.$config['index']);
$x = exec('egrep '.escshellarg($regexp).' '.$config['index']);
if ($x) {
return CAdb_explode_entry($x);
} else {
@@ -341,7 +341,7 @@ function CAdb_in($email = "", $name = "")
$email = escshellcmd($email);
$name = escshellcmd($name);
$regexp = "^[V].*CN=$name/(Email|emailAddress)=$email";
$x =exec('egrep '.escshellarg($regexp).' '.$config['index']);
$x = exec('egrep '.escshellarg($regexp).' '.$config['index']);
if ($x) {
list($j,$j,$j,$serial,$j,$j) = explode("\t", $x);
@@ -418,26 +418,26 @@ function CAdb_explode_entry($dbentry)
// Compatibility with migrated certs from openvpn-bridge
if (count($b) == 7) {
$db['serial'] = $a[3];
$db['country'] = $b[1];
$db['province'] = $b[2];
$db['locality'] = '';
$db['organization'] = $b[3];
$db['issuer'] = '';
$db['unit'] = $b[4];
$db['common_name'] = $b[5];
$db['email'] = $b[6];
$db['serial'] = $a[3];
$db['country'] = $b[1];
$db['province'] = $b[2];
$db['locality'] = '';
$db['organization'] = $b[3];
$db['issuer'] = '';
$db['unit'] = $b[4];
$db['common_name'] = $b[5];
$db['email'] = $b[6];
} // Compatibility with renewed certs from openvpn-bridge
elseif (count($b) == 8) {
$db['serial'] = $a[3];
$db['country'] = $b[1];
$db['province'] = $b[2];
$db['locality'] = $b[3];
$db['organization'] = $b[4];
$db['issuer'] = '';
$db['unit'] = $b[5];
$db['common_name'] = $b[6];
$db['email'] = $b[7];
$db['serial'] = $a[3];
$db['country'] = $b[1];
$db['province'] = $b[2];
$db['locality'] = $b[3];
$db['organization'] = $b[4];
$db['issuer'] = '';
$db['unit'] = $b[5];
$db['common_name'] = $b[6];
$db['email'] = $b[7];
} // Else, it's a certificate created with phpki
else {
$db['serial'] = $a[3];
@@ -462,7 +462,7 @@ function CAdb_is_revoked($serial)
{
global $config;
$regexp = "^R\t.*\t.*\t$serial\t.*\t.*$";
$x = exec('egrep '.escshellarg($regexp).' '.$config['index']);
$x = exec('egrep '.escshellarg($regexp).' '.$config['index']);
if ($x) {
list($j,$j,$revoke_date,$j,$j,$j) = explode("\t", $x);
@@ -633,6 +633,7 @@ function CA_create_cert($cert_type = 'email', $country, $province, $locality, $o
$userkey = $config['private_dir'] . "/$serial-key.pem";
$userreq = $config['req_dir'] ."/$serial-req.pem";
$usercert = $config['new_certs_dir'].'/'.$serial.'.pem';
$userder = $config['cert_dir'] . "/$serial.der";
$userpfx = $config['pfx_dir'] . "/$serial.pfx";