Revision 29e6a815
Added by Renato Botelho over 9 years ago
src/etc/inc/certs.inc | ||
---|---|---|
692 | 692 |
} |
693 | 693 |
} |
694 | 694 |
|
695 |
function is_package_cert($certref) { |
|
696 |
$pluginparams = array(); |
|
697 |
$pluginparams['type'] = 'certificates'; |
|
698 |
$pluginparams['event'] = 'used_certificates'; |
|
699 |
|
|
700 |
$certificates_used_by_packages = pkg_call_plugins('plugin_certificates', $pluginparams); |
|
701 |
|
|
702 |
/* Check if any package is using certificate */ |
|
703 |
foreach ($certificates_used_by_packages as $name => $package) { |
|
704 |
if (is_array($package['certificatelist'][$certref]) && |
|
705 |
isset($package['certificatelist'][$certref]) > 0) { |
|
706 |
return true; |
|
707 |
} |
|
708 |
} |
|
709 |
} |
|
710 |
|
|
695 | 711 |
function is_captiveportal_cert($certref) { |
696 | 712 |
global $config; |
697 | 713 |
if (!is_array($config['captiveportal'])) { |
... | ... | |
706 | 722 |
} |
707 | 723 |
|
708 | 724 |
function cert_in_use($certref) { |
725 |
|
|
709 | 726 |
return (is_webgui_cert($certref) || |
710 | 727 |
is_user_cert($certref) || |
711 | 728 |
is_openvpn_server_cert($certref) || |
712 | 729 |
is_openvpn_client_cert($certref) || |
713 | 730 |
is_ipsec_cert($certref) || |
714 |
is_captiveportal_cert($certref)); |
|
731 |
is_captiveportal_cert($certref) || |
|
732 |
is_package_cert($certref)); |
|
715 | 733 |
} |
716 | 734 |
|
717 | 735 |
function crl_create(& $crl, $caref, $name, $serial = 0, $lifetime = 9999) { |
Also available in: Unified diff
Do not allow certificate to be deleted if it's been used by a package. Fixes #4142