summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Dörre <felix@dogcraft.de>2014-06-17 18:59:30 +0200
committerFelix Dörre <felix@dogcraft.de>2014-06-17 19:33:49 +0200
commit552516401a472abea7062a5762ec25cda26965ef (patch)
tree9af39619a2dd0ae69e68a17b25ad9053c50a796c
parentddabc10cd826ee00015732e8bff2141438ce282f (diff)
downloadcacert-devel-552516401a472abea7062a5762ec25cda26965ef.tar.gz
cacert-devel-552516401a472abea7062a5762ec25cda26965ef.tar.xz
cacert-devel-552516401a472abea7062a5762ec25cda26965ef.zip
bug 773: correct email sending for domaincerts
-rwxr-xr-xCommModule/client.pl46
1 files changed, 31 insertions, 15 deletions
diff --git a/CommModule/client.pl b/CommModule/client.pl
index 78b229d..1803cd2 100755
--- a/CommModule/client.pl
+++ b/CommModule/client.pl
@@ -1025,22 +1025,27 @@ sub RevokeCerts($$)
{
$dbh->do("update `$table` set `revoked`=now() where `id`='".$row{'id'}."'");
- my $memid = $row{memid};
- if($server)
+ if($org eq "")
{
- $memid = getMemidFromDomid($row{domid});
+ if($server)
+ {
+ my @a=$dbh->selectrow_array("select `memid` from `domains` where `id`='".int($row{domid})."'");
+ sendRevokeMail($a[0], $row{'CN'}, $row{'serial'});
+ }
+ else
+ {
+ sendRevokeMail($row{memid}, $row{'CN'}, $row{'serial'});
+ }
}
- if($org == "")
+ else
{
- setUsersLanguage($memid);
+ my $orgsth = $dbh->prepare("select `memid` from `org` where `orgid`='".int($row{orgid})."'");
+ $orgsth->execute();
+ while ( my ($memid) = $orgsth->fetchrow_array() )
+ {
+ sendRevokeMail($memid, $row{'CN'}, $row{'serial'});
+ }
- my %user=getUserData($memid);
-
- my $body = _("Hi")." $user{fname},\n\n";
- $body .= sprintf(_("Your certificate for '%s' with the serial number '%s' has been revoked, as per request.")."\n\n", $row{'CN'}, $row{'serial'});
- $body .= _("Best regards")."\n"._("CAcert.org Support!")."\n\n";
- SysLog("Sending email to ".$user{"email"}."\n") if($debug);
- sendmail($user{email}, "[CAcert.org] "._("Your certificate"), $body, "support\@cacert.org", "", "", "CAcert Support");
}
}
@@ -1054,10 +1059,21 @@ sub RevokeCerts($$)
}
-sub getMemidFromDomid()
+sub sendRevokeMail()
{
- my @a=$dbh->selectrow_array("select memid from domains where id='".int($_[0])."'");
- return $a[0];
+ my $memid = $_[0];
+ my $certName = $_[1];
+ my $serial = $_[2];
+ setUsersLanguage($memid);
+
+ my %user=getUserData($memid);
+
+ my $body = _("Hi")." $user{fname},\n\n";
+ $body .= sprintf(_("Your certificate for '%s' with the serial number '%s' has been revoked, as per request.")."\n\n", $certName, $serial);
+ $body .= _("Best regards")."\n"._("CAcert.org Support!")."\n\n";
+ SysLog("Sending email to ".$user{"email"}."\n") if($debug);
+ sendmail($user{email}, "[CAcert.org] "._("Your certificate"), $body, "support\@cacert.org", "", "", "CAcert Support");
+
}