[otrs-cvs] otrs/Kernel/System/Scheduler TaskManager.pm,1.17,1.18
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/System/Scheduler
In directory lancelot:/tmp/cvs-serv31992/Kernel/System/Scheduler
Modified Files:
TaskManager.pm
Log Message:
Fixed bug#9030 - Wrong handling of Invalid YAML in Scheduler Tasks.
Author: cr
Index: TaskManager.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Scheduler/TaskManager.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -2 -u -d -r1.17 -r1.18
--- TaskManager.pm 20 Nov 2012 15:56:21 -0000 1.17
+++ TaskManager.pm 9 Jan 2013 18:21:51 -0000 1.18
@@ -1,5 +1,5 @@
# --
# Kernel/System/Scheduler/TaskManager.pm - Scheduler TaskManager backend
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -135,6 +135,32 @@
}
- # dump config as string
- my $Data = YAML::Dump( $Param{Data} );
+ my $Data;
+
+ # eval if data can be converted to YAML
+ eval {
+
+ # dump data as string
+ $Data = YAML::Dump( $Param{Data} );
+ };
+
+ # display any YAML error message as a normal otrs error message and return
+ if ($@) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => $@,
+ );
+ return;
+ }
+
+ # check if Data fits in the database
+ my $MaxDataLength = $Self->{ConfigObject}->Get('Scheduler::TaskDataLength') || 8_000;
+
+ if ( length $Data > $MaxDataLength ) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => 'Task data is too large for the current Database.',
+ );
+ return;
+ }
# md5 of content
@@ -201,9 +227,30 @@
my %Data;
while ( my @Data = $Self->{DBObject}->FetchrowArray() ) {
- my $DataParam = YAML::Load( $Data[0] );
+
+ my $DataParam;
+
+ # eval if YAML content can be readed
+ eval {
+ $DataParam = YAML::Load( $Data[0] );
+ };
+
+ # display any YAML error message as a normal otrs error message
+ if ($@) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => $@,
+ );
+ }
+
+ if ( !$DataParam ) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => 'Task data is not in a correct YAML format! ' . $Data[0],
+ );
+ }
%Data = (
ID => $Param{ID},
- Data => $DataParam,
+ Data => $DataParam || '',
Type => $Data[1],
DueTime => $Data[2],
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log