[Rt-commit] rt branch, 4.4/crypt-minor-fixes, updated. rt-4.4.4-240-ge4188fa682
Dianne Skoll
dianne at bestpractical.com
Tue Feb 2 14:40:52 EST 2021
The branch, 4.4/crypt-minor-fixes has been updated
via e4188fa682b45181f6536276638b23acd2cefd2e (commit)
from 0e15eb9e5f4fb42bcca62ad32f64eb3a071b9b93 (commit)
Summary of changes:
.../Crypt/{GetGPGPubkey.html => GetSMIMECert.html} | 24 ++++++++++++----------
share/html/Elements/CryptStatus | 9 ++++++--
2 files changed, 20 insertions(+), 13 deletions(-)
copy share/html/Crypt/{GetGPGPubkey.html => GetSMIMECert.html} (78%)
- Log -----------------------------------------------------------------
commit e4188fa682b45181f6536276638b23acd2cefd2e
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Tue Feb 2 14:36:27 2021 -0500
Add ability to download S/MIME certificates
diff --git a/share/html/Crypt/GetSMIMECert.html b/share/html/Crypt/GetSMIMECert.html
new file mode 100644
index 0000000000..f7d6d198ff
--- /dev/null
+++ b/share/html/Crypt/GetSMIMECert.html
@@ -0,0 +1,79 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2021 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header,
+ Title => $title
+ &>
+<& /Elements/Tabs &>
+
+<& /Elements/ListActions, actions => \@results &>
+
+<%ARGS>
+$User => undef
+$title => loc('Download S/MIME Certificate')
+</%ARGS>
+
+<%INIT>
+my @results;
+if (!$User || $User !~ /^\d+$/) {
+ push(@results, loc('User must be supplied to download an S/MIME certificate.'));
+} else {
+ my $u = RT::User->new(RT->SystemUser);
+ $u->Load($User);
+ if (!$u->id || !$u->SMIMECertificate) {
+ push(@results, loc('Could not find S/MIME certificate for specified user'));
+ } else {
+ my $name = $u->EmailAddress || $u->Name || $u->id;
+ $r->content_type('application/x-x509-user-cert');
+ $r->header_out('Content-Disposition' => "attachment; filename=\"$name.crt\"");
+ $m->out($u->SMIMECertificate);
+ $m->flush_buffer;
+ $m->abort();
+ }
+}
+
+</%INIT>
diff --git a/share/html/Elements/CryptStatus b/share/html/Elements/CryptStatus
index 362a9c1570..028e478db5 100644
--- a/share/html/Elements/CryptStatus
+++ b/share/html/Elements/CryptStatus
@@ -110,14 +110,19 @@ sub VerifyTooltip {
# Generate a download link for the public key
sub KeyDownloadLink {
- my ($protocol, $line) = @_;
+ my ($Message, $protocol, $line) = @_;
my $txt = '';
if ($protocol eq 'GnuPG') {
if ($line->{Fingerprint} && $line->{Fingerprint} !~ /[^0-9A-F]/i) {
$txt = '<a href="' . RT->Config->Get('WebPath') . '/Crypt/GetGPGPubkey.html?Fingerprint=' . $line->{Fingerprint} . '"> ' . loc('(Download Public Key)') . '</a>';
}
+ } elsif ($protocol eq 'SMIME') {
+ if ($Message && $Message->TransactionObj && $Message->TransactionObj->Creator) {
+ $txt = '<a href="' . RT->Config->Get('WebPath') . '/Crypt/GetSMIMECert.html?User=' . $Message->TransactionObj->Creator . '"> ' . loc('(Download S/MIME Certificate)') . '</a>';
+ }
}
+
# There isn't really a feasible way to download the S/MIME
# certificate, unfortunately. However, since RT makes the
# original message available, the S/MIME cert could be
@@ -224,7 +229,7 @@ foreach my $run ( @runs ) {
push @messages, {
Tag => $protocol,
Classes => ['verify', lc $line->{Status}, 'trust-'.($line->{Trust} || 'UNKNOWN')],
- Value => '<span title="' . $m->interp->apply_escapes(VerifyTooltip($protocol, $line), 'h') . '">' . $m->interp->apply_escapes(loc( $line->{'Message'} ), 'h') . '</span>' . KeyDownloadLink($protocol, $line),
+ Value => '<span title="' . $m->interp->apply_escapes(VerifyTooltip($protocol, $line), 'h') . '">' . $m->interp->apply_escapes(loc( $line->{'Message'} ), 'h') . '</span>' . KeyDownloadLink($Message, $protocol, $line),
};
}
else {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list