From ddabc10cd826ee00015732e8bff2141438ce282f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20D=C3=B6rre?= Date: Tue, 17 Jun 2014 17:58:29 +0200 Subject: bug 773: fix sending email on revocation. Use the email (and language) of domain owner to send mail. --- CommModule/client.pl | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'CommModule') diff --git a/CommModule/client.pl b/CommModule/client.pl index c337d94..78b229d 100755 --- a/CommModule/client.pl +++ b/CommModule/client.pl @@ -1023,17 +1023,25 @@ sub RevokeCerts($$) if($result) { - setUsersLanguage($row{memid}); - - my %user=getUserData($row{memid}); - $dbh->do("update `$table` set `revoked`=now() where `id`='".$row{'id'}."'"); - 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"); + my $memid = $row{memid}; + if($server) + { + $memid = getMemidFromDomid($row{domid}); + } + if($org == "") + { + 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", $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"); + } } } @@ -1046,6 +1054,12 @@ sub RevokeCerts($$) } +sub getMemidFromDomid() +{ + my @a=$dbh->selectrow_array("select memid from domains where id='".int($_[0])."'"); + return $a[0]; +} + -- cgit v1.2.1 From 552516401a472abea7062a5762ec25cda26965ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20D=C3=B6rre?= Date: Tue, 17 Jun 2014 18:59:30 +0200 Subject: bug 773: correct email sending for domaincerts --- CommModule/client.pl | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'CommModule') 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"); + } -- cgit v1.2.1 From b275df70541737f4bc1576db57e7236e105f101f Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Tue, 17 Jun 2014 22:56:21 +0200 Subject: bug 773: Whitespace at EOL and indentation --- CommModule/client.pl | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'CommModule') diff --git a/CommModule/client.pl b/CommModule/client.pl index 1803cd2..bc8919d 100755 --- a/CommModule/client.pl +++ b/CommModule/client.pl @@ -1025,28 +1025,27 @@ sub RevokeCerts($$) { $dbh->do("update `$table` set `revoked`=now() where `id`='".$row{'id'}."'"); - if($org eq "") - { - 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'}); - } - } - else - { - 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'}); - } - - } + if($org eq "") + { + 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'}); + } + } + else + { + 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'}); + } + } } } @@ -1065,20 +1064,18 @@ sub sendRevokeMail() 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"); - } - sub HandleGPG() { my $sth = $dbh->prepare("select * from gpg where crt='' and csr!='' "); -- cgit v1.2.1