Revised commit of 3.php to limit it to the bare minimum. #33

Open
bmc wants to merge 3 commits from fix/bug-1550a into main
Showing only changes of commit 9300b1742e - Show all commits

View file

@ -40,9 +40,6 @@ my $paranoid=1;
my $debug=0; my $debug=0;
# number of attempts before giving up
Review

please do not revert the changes in client.pl, they where required improvements

please do not revert the changes in client.pl, they where required improvements
Review

The changes were implemented in #31

The changes were implemented in https://code.cacert.org/cacert/cacert-webdb/pulls/31
my $warn_threshold = 3;
#my $serialport="/dev/ttyS0"; #my $serialport="/dev/ttyS0";
my $serialport="/dev/ttyUSB0"; my $serialport="/dev/ttyUSB0";
@ -737,9 +734,7 @@ sub HandleCerts($$)
SysLog "HandleCerts $table\n"; SysLog "HandleCerts $table\n";
my $sth = $dbh->prepare(sprintf( my $sth = $dbh->prepare("select * from $table where crt_name='' and csr_name!='' and warning<3");
"select * from %s where crt_name='' and csr_name!='' and warning<%d", $table, $warn_threshold
));
$sth->execute(); $sth->execute();
#$rowdata; #$rowdata;
while ( my $rowdata = $sth->fetchrow_hashref() ) while ( my $rowdata = $sth->fetchrow_hashref() )
@ -909,7 +904,7 @@ sub HandleCerts($$)
else else
{ {
SysLog("Could not find the issued certificate. $crtname ".$row{"id"}."\n"); SysLog("Could not find the issued certificate. $crtname ".$row{"id"}."\n");
$dbh->do(sprintf("update %s set warning=warning+1 where id=%d", $table, $row{'id'})); $dbh->do("update `$table` set warning=warning+1 where `id`='".$row{'id'}."'");
} }
} }
} }
@ -1083,9 +1078,7 @@ sub sendRevokeMail()
sub HandleGPG() sub HandleGPG()
{ {
my $sth = $dbh->prepare(sprintf( my $sth = $dbh->prepare("select * from gpg where crt='' and csr!='' ");
"select * from gpg where crt='' and csr!='' and warning<%d", $warn_threshold
));
$sth->execute(); $sth->execute();
my $rowdata; my $rowdata;
while ( $rowdata = $sth->fetchrow_hashref() ) while ( $rowdata = $sth->fetchrow_hashref() )
@ -1151,7 +1144,7 @@ sub HandleGPG()
sendmail($user{email}, "[CAcert.org] Your GPG/PGP Key", $body, "support\@cacert.org", "", "", "CAcert Support"); sendmail($user{email}, "[CAcert.org] Your GPG/PGP Key", $body, "support\@cacert.org", "", "", "CAcert Support");
} else { } else {
SysLog("Could not find the issued gpg key. ".$row{"id"}."\n"); SysLog("Could not find the issued gpg key. ".$row{"id"}."\n");
$dbh->do(sprintf("update gpg set warning=warning+1 where id=%d", $row{'id'})); #$dbh->do("delete from `gpg` where `id`='".$row{'id'}."'");
} }
} }
} }