Switched to new directory layout

pull/1/head
Philipp Dunkel 15 years ago
parent 13d4c7554c
commit 6bd322fd54

@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# CommModule - CAcert Communication Module
# Copyright (C) 2006-2008 CAcert Inc.
# Copyright (C) 2006-2009 CAcert Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -52,6 +52,7 @@ my $mysqlphp="/home/cacert/www/includes/mysql.php";
my %revokefile=(2=>"../www/class3-revoke.crl",1=>"../www/revoke.crl",0=>"../www/revoke.crl");
my $newlayout=1;
#End of configurations
@ -583,6 +584,7 @@ sub setUsersLanguage($)
sub getUserData($)
{
return() unless($_[0]=~m/^\d+$/);
my $sth = $dbh->prepare("select * from users where id='$_[0]'");
$sth->execute();
#SysLog "USER DUMP:\n";
@ -705,10 +707,15 @@ sub HandleCerts($$)
while ( my $rowdata = $sth->fetchrow_hashref() )
{
my %row=%{$rowdata};
my $prefix=$org.($server?"server":"client");
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 $csrname = "../csr/".$org.($server?"server-":"client-").$row{'id'}.".csr";
my $crtname = "../crt/".$org.($server?"server-":"client-").$row{'id'}.".crt";
#my $crtname = "../crt/$prefix-".$row{'id'}.".crt";
my $crtname=$csrname; $crtname=~s/^\.\.\/csr/..\/crt/; $crtname=~s/\.csr$/.crt/;
SysLog("New Layout: $crtname\n");
if($server)
{
@ -874,8 +881,19 @@ sub RevokeCerts($$)
{
my %row=%{$rowdata};
my $csrname = "../csr/".$org.($server?"server-":"client-").$row{'id'}.".csr";
my $crtname = "../crt/".$org.($server?"server-":"client-").$row{'id'}.".crt";
my $prefix=$org.($server?"server":"client");
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 $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/".$org.($server?"server-":"client-").$row{'id'}.".csr";
#my $crtname = "../crt/".$org.($server?"server-":"client-").$row{'id'}.".crt";
my $crlname = $revokefile{$row{'rootcert'}};
my $crt="";
@ -912,6 +930,10 @@ sub RevokeCerts($$)
# print OUT $crl;
# close OUT;
#}
#
#
#!!! We should verify the CRL format and validity here, before we rename it.
#
rename "$crlname.tmp","$crlname";
}
@ -954,8 +976,19 @@ sub HandleGPG()
{
my %row=%{$rowdata};
my $csrname = "../csr/gpg-".$row{'id'}.".csr";
my $crtname = "../crt/gpg-".$row{'id'}.".crt";
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 $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";
SysLog "Opening $csrname\n";

Loading…
Cancel
Save