summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-07-07 13:42:08 -0400
committerjim-p <jimp@pfsense.org>2010-07-07 13:42:08 -0400
commitdab2e7699e8735fc8055b793847a27977950e7ca (patch)
tree0659ce32ec2ba8637c9ad9bdaa1389f3649ebbb2 /etc
parentecefc738d72fef321fd00f9c624fead7390348b7 (diff)
downloadpfsense-dab2e7699e8735fc8055b793847a27977950e7ca.zip
pfsense-dab2e7699e8735fc8055b793847a27977950e7ca.tar.gz
Add some user cert lookup functions.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/certs.inc26
1 files changed, 26 insertions, 0 deletions
diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc
index 6d48e55..763c25d 100644
--- a/etc/inc/certs.inc
+++ b/etc/inc/certs.inc
@@ -335,4 +335,30 @@ function cert_get_issuer($str_crt, $decode = true) {
return $issuer;
}
+function get_all_user_certs($certsonly=false) {
+ global $config;
+ $usercerts = array();
+ if (!is_array($config['system']['user']))
+ return;
+ foreach ($config['system']['user'] as $user) {
+ if (!is_array($user['cert']))
+ continue;
+ foreach ($user['cert'] as $cert) {
+ $usercerts[] = $certsonly ? $cert['crt'] : $cert;
+ }
+ }
+ return $usercerts;
+}
+
+function get_all_certs_tree() {
+ global $config;
+ $cert_tree = array();
+ foreach ($config['system']['ca'] as $ca)
+ $cert_tree[$ca['refid']] = $ca;
+ $usercerts = get_all_user_certs();
+ foreach ($usercerts as $cert)
+ $cert_tree[$cert['caref']]['certs'][] = $cert;
+ return $cert_tree;
+}
+
?>
OpenPOWER on IntegriCloud