[Bps-public-commit] RT-Extension-CommandByMail branch, ignore-unknown-commands, created. 2.01-2-g934a451
Dustin Graves
dustin at bestpractical.com
Fri Aug 12 15:46:45 EDT 2016
The branch, ignore-unknown-commands has been created
at 934a451a36d9c2280a32f90c51e55862f24ac858 (commit)
- Log -----------------------------------------------------------------
commit 934a451a36d9c2280a32f90c51e55862f24ac858
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 12 19:12:00 2016 +0000
add config setting $CommandByMailSkipUnknown to suppress unknown command errors/crits
diff --git a/README b/README
index b2bfcdf..c1fa9c2 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.
+ $CommandByMailSkipUnknown
+ Traditionally, this extension throws an error if it finds an unknown
+ command. Setting this will make CommandByMail silently skip them
+ instead.
+
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..33d9a49 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -106,6 +106,11 @@ as well. For example:
If set, the body will not be examined, only the header defined by the previous
configuration option.
+=head2 C<$CommandByMailSkipUnknown>
+
+Traditionally, this extension throws an error if it finds an unknown command.
+Setting this will make CommandByMail silently skip them instead.
+
=head1 CAVEATS
This extension is incompatible with C<UnsafeEmailCommands> RT option.
@@ -376,6 +381,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 +877,7 @@ sub _CheckCommand {
return 1 if grep $cmd eq lc $_, @LINK_ATTRIBUTES, @WATCHER_ATTRIBUTES;
}
+ return 2 if RT->Config->Get('CommandByMailSkipUnknown');
return (0, "Command '$cmd' is unknown");
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list