diff options
Diffstat (limited to 'CommModule/client.pl')
-rwxr-xr-x | CommModule/client.pl | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/CommModule/client.pl b/CommModule/client.pl index 0874477..24f0abc 100755 --- a/CommModule/client.pl +++ b/CommModule/client.pl @@ -40,8 +40,8 @@ my $paranoid=1; my $debug=0; -#my $serialport="/dev/ttyS0"; -my $serialport="/dev/ttyUSB0"; +my $serialport="/dev/ttyS1"; +#my $serialport="/dev/ttyUSB0"; my $gpgbin="/usr/bin/gpg"; @@ -441,12 +441,12 @@ sub calculateDays($) { if($_[0]) { - my @sum = $dbh->selectrow_array("select sum(`points`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 group by `to`"); + my @sum = $dbh->selectrow_array("select sum(`awarded`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to` group by `to`"); SysLog("Summe: $sum[0]\n") if($debug); - return ($sum[0]>=50)?730:180; + return ($sum[0]>=50)?30:3; } - return 180; + return 3; } sub X509extractSAN($) @@ -832,7 +832,7 @@ sub HandleCerts($$) SysLog "SAN: --$SAN--\n" if($debug); SysLog "memid: $row{'memid'}\n" if($debug); - my $days=$org?($server?(365*2):365):calculateDays($row{"memid"}); + my $days=$org?30:calculateDays($row{"memid"}); my $md_id = 0; $md_id = 1 if( $row{'md'} eq "md5"); @@ -1087,15 +1087,20 @@ sub HandleGPG() my $prefix="gpg"; my $short=int($row{'id'}/1000); - my $csrname = "../csr/$prefix-".$row{'id'}.".csr"; - $csrname = "../csr/$prefix/$short/$prefix-".$row{'id'}.".csr" if($newlayout); - SysLog("New Layout: "."../csr/$prefix/$short/$prefix-".$row{'id'}.".csr\n"); + + my $dirname="../csr"; + $dirname="../csr/$prefix/$short" if ($newlayout); + + #Ensure the directory exists + mkdir $dirname, 0755; + + my $csrname = "$dirname/$prefix-".$row{'id'}.".csr"; + SysLog("New Layout: $csrname\n"); #my $crtname = "../crt/$prefix-".$row{'id'}.".crt"; my $crtname=$csrname; $crtname=~s/^\.\.\/csr/..\/crt/; $crtname=~s/\.csr$/.crt/; SysLog("New Layout: $crtname\n"); - #my $csrname = "../csr/gpg-".$row{'id'}.".csr"; #my $crtname = "../crt/gpg-".$row{'id'}.".crt"; |