summaryrefslogtreecommitdiff
path: root/FS/FS/svc_cert.pm
diff options
context:
space:
mode:
authorivan <ivan>2010-11-07 23:47:04 +0000
committerivan <ivan>2010-11-07 23:47:04 +0000
commit874ad675da1321638b374d0b574231d7fa577196 (patch)
tree3ca9ad29f55550256e676ac4a752dedbbafa0f17 /FS/FS/svc_cert.pm
parent5ac9e46a92f4eefd795f97643f3e8f62ec1a2b26 (diff)
certificates ala communigate, RT#7515
Diffstat (limited to 'FS/FS/svc_cert.pm')
-rw-r--r--FS/FS/svc_cert.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/FS/FS/svc_cert.pm b/FS/FS/svc_cert.pm
index e3ef325..36e7582 100644
--- a/FS/FS/svc_cert.pm
+++ b/FS/FS/svc_cert.pm
@@ -2,6 +2,7 @@ package FS::svc_cert;
use strict;
use base qw( FS::svc_Common );
+use Tie::IxHash;
#use FS::Record qw( qsearch qsearchs );
use FS::cust_svc;
@@ -251,14 +252,18 @@ sub check_privatekey {
return ($ok =~ /key ok/);
}
-my %subj = (
+tie my %subj, 'Tie::IxHash',
'CN' => 'common_name',
'O' => 'organization',
'OU' => 'organization_unit',
'L' => 'city',
'ST' => 'state',
'C' => 'country',
-);
+;
+
+sub subj_col {
+ \%subj;
+}
sub subj {
my $self = shift;
@@ -343,11 +348,25 @@ sub check_certificate {
my %hash = ();
while (<OUT>) {
- warn $_;
/^\s*(\w+)=\s*(.*)\s*$/ or next;
$hash{$1} = $2;
}
+ for my $f (qw( subject issuer )) {
+
+ $hash{$f} = { map { if ( /^\s*(\w+)=\s*(.*)\s*$/ ) {
+ ($1=>$2);
+ } else {
+ (''=>'');
+ }
+ }
+ split('/', $hash{$f})
+ };
+
+ }
+
+ $hash{'selfsigned'} = 1 if $hash{'subject'}->{'O'} eq $hash{'issuer'}->{'O'};
+
%hash;
}