Remove Create and Download Certificate

This commit is contained in:
John Crisp
2021-04-02 13:22:32 +02:00
parent aaa6d96ac5
commit 3ccd6eec38

View File

@@ -207,29 +207,29 @@ switch ($form_stage) {
<h4>Are you sure? After creation you will be returned to the Create Certificate dialogue.</h4> <h4>Are you sure? After creation you will be returned to the Create Certificate dialogue.</h4>
<p><form action='<?php echo $PHP_SELF?>' method=post> <p><form action='<?php echo $PHP_SELF?>' method=post>
<?php echo $hidden_fields ?> <?php echo $hidden_fields ?>
<input type=hidden name=form_stage value=final> <input type=hidden name=form_stage value=final>
<input type=submit name=submit value='Yes. Create and Download' >&nbsp; <!-- <input type=submit name=submit value='Yes. Create and Download' >&nbsp; -->
<input type=submit name=submit value='Yes. Just Create' >&nbsp; <input type=submit name=submit value='Yes. Just Create' >&nbsp;
<input type=submit name=submit value='Go Back'> <input type=submit name=submit value='Go Back'>
</form> </form>
<?php <?php
printFooter(); printFooter();
# Save user's defaults # Save user's defaults
$fp = fopen($user_cnf, 'w'); $fp = fopen($user_cnf, 'w');
$x = '<?php $x = '<?php
$country = \''.addslashes($country).'\'; $country = \''.addslashes($country).'\';
$locality = \''.addslashes($locality).'\'; $locality = \''.addslashes($locality).'\';
$province = \''.addslashes($province).'\'; $province = \''.addslashes($province).'\';
$organization = \''.addslashes($organization).'\'; $organization = \''.addslashes($organization).'\';
$unit = \''.addslashes($unit).'\'; $unit = \''.addslashes($unit).'\';
$expiry = \''.addslashes($expiry).'\'; $expiry = \''.addslashes($expiry).'\';
$keysize = \''.addslashes($keysize).'\'; $keysize = \''.addslashes($keysize).'\';
?>'; ?>';
fwrite($fp, $x); fwrite($fp, $x);
fclose($fp); fclose($fp);
break; break;
@@ -263,21 +263,27 @@ switch ($form_stage) {
} }
} }
// This section is disabled in the form above
// If we do Download it does not return to Create New cert
// I believe this is because the upload function messes the http headers
// There may be a solution but I haven't got one
if ($submit == "Yes. Create and Download") { if ($submit == "Yes. Create and Download") {
switch ($cert_type) { switch ($cert_type) {
case 'server': case 'server':
# upload(array("$config[private_dir]/$serial-key.pem","$config[new_certs_dir]/$serial.pem",$config['cacert_pem']), "$common_name ($email).pem",'application/pkix-cert'); # upload(array("$config[private_dir]/$serial-key.pem","$config[new_certs_dir]/$serial.pem",$config['cacert_pem']), "$common_name ($email).pem",'application/pkix-cert');
upload(array($config['private_dir'] . "/$serial-key.pem",$config['new_certs_dir'] . "/$serial.pem",$config['cacert_pem']), $rec['common_name'] . "-Bundle.pem", 'application/pkix-cert'); upload(array($config['private_dir'] . "/$serial-key.pem",$config['new_certs_dir'] . "/$serial.pem",$config['cacert_pem']), $rec['common_name'] . "-Bundle.pem", 'application/pkix-cert');
break; break; # << Here
case 'email': case 'email':
case 'email_signing': case 'email_signing':
case 'time_stamping': case 'time_stamping':
case 'vpn_client_server': case 'vpn_client_server':
case 'vpn_client': case 'vpn_client':
case 'vpn_server': case 'vpn_server':
# upload("$config[pfx_dir]/$serial.pfx", "$common_name ($email).p12", 'application/x-pkcs12'); # upload("$config[pfx_dir]/$serial.pfx", "$common_name ($email).p12", 'application/x-pkcs12');
upload($config['pfx_dir'] . "/$serial.pfx", $rec['common_name'] . ".p12", 'application/x-pkcs12'); upload($config['pfx_dir'] . "/$serial.pfx", $rec['common_name'] . ".p12", 'application/x-pkcs12');
break; break; # << here
} }
# Clear common_name fields # Clear common_name fields