[Bps-public-commit] RT-Extension-CommandByMail branch, ignore-unknown-commands, created. 2.01-2-g7387999
Dustin Graves
dustin at bestpractical.com
Mon Aug 22 18:04:23 EDT 2016
The branch, ignore-unknown-commands has been created
at 738799920a98fae4491ef19c82c35e8c3ac890d9 (commit)
- Log -----------------------------------------------------------------
commit 738799920a98fae4491ef19c82c35e8c3ac890d9
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 12 19:12:00 2016 +0000
remove error for unknown commands and add config setting $CommandByMailErrorOnUnknown to restore default behavior
diff --git a/README b/README
index b2bfcdf..79b01d4 100644
--- a/README
+++ b/README
@@ -75,6 +75,11 @@ CONFIGURATION
If set, the body will not be examined, only the header defined by the
previous configuration option.
+ $CommandByMailErrorOnUnknown
+ Prior to 2.02, this extension throws an error if it finds an unknown
+ command. This is no longer the case. Setting this option will restore
+ that legacy behavior.
+
CAVEATS
This extension is incompatible with UnsafeEmailCommands RT option.
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index cc20218..fdc9d71 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -106,6 +106,12 @@ as well. For example:
If set, the body will not be examined, only the header defined by the previous
configuration option.
+=head2 C<$CommandByMailErrorOnUnknown>
+
+Prior to 2.02, this extension throws an error if it finds an unknown command.
+This is no longer the case. Setting this option will restore that legacy
+behavior.
+
=head1 CAVEATS
This extension is incompatible with C<UnsafeEmailCommands> RT option.
@@ -376,6 +382,11 @@ sub ProcessCommands {
foreach my $cmd ( keys %cmds ) {
my ($val, $msg) = _CheckCommand( $cmd );
+ if ($val == 2) {
+ delete $cmds{$cmd};
+ RT->Logger->debug("Skipping unknown command '$cmd'");
+ next;
+ }
unless ( $val ) {
$results{ $cmd } = {
value => delete $cmds{ $cmd },
@@ -867,6 +878,7 @@ sub _CheckCommand {
return 1 if grep $cmd eq lc $_, @LINK_ATTRIBUTES, @WATCHER_ATTRIBUTES;
}
+ return 2 unless RT->Config->Get('CommandByMailErrorOnUnknown');
return (0, "Command '$cmd' is unknown");
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list