[otrs-cvs] otrs/Kernel/Modules AdminSMIME.pm,1.47,1.48

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv13926/Kernel/Modules

Modified Files:
	AdminSMIME.pm 
Log Message:
Fixed uninitialized errors on loading invalid files from SMIME directories, added explicit details to detect those files.

Author: cr

Index: AdminSMIME.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminSMIME.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -2 -u -d -r1.47 -r1.48
--- AdminSMIME.pm	20 Nov 2012 14:44:12 -0000	1.47
+++ AdminSMIME.pm	6 Feb 2013 22:28:18 -0000	1.48
@@ -1,5 +1,5 @@
 # --
 # Kernel/Modules/AdminSMIME.pm - to add/update/delete smime keys
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -92,5 +92,5 @@
             push @Result, \%Result if %Result;
 
-            if ( $Attributes{Private} eq 'Yes' ) {
+            if ( defined $Attributes{Private} && $Attributes{Private} eq 'Yes' ) {
                 %Result = $Self->{CryptObject}->PrivateRemove( Filename => $Filename );
                 push @Result, \%Result if %Result;
@@ -584,9 +584,16 @@
     if (@List) {
         for my $Attributes (@List) {
+
+            # check if there is an invalid file in the SMIME directories and add explicit
+            # attributes to make it more easy to identify
+            if ( !defined $Attributes->{Type} && !defined $Attributes->{Subject} ) {
+                $Attributes->{Type}    = 'Invalid';
+                $Attributes->{Subject} = "The file: '$Attributes->{Filename}' is invalid";
+            }
             $Self->{LayoutObject}->Block(
                 Name => 'Row',
                 Data => $Attributes,
             );
-            if ( $Attributes->{Type} eq 'key' ) {
+            if ( defined $Attributes->{Type} && $Attributes->{Type} eq 'key' ) {
                 $Self->{LayoutObject}->Block(
                     Name => 'CertificateRelationAdd',
@@ -594,5 +601,5 @@
                 );
             }
-            elsif ( $Attributes->{Type} eq 'cert' ) {
+            elsif ( defined $Attributes->{Type} && $Attributes->{Type} eq 'cert' ) {
                 $Self->{LayoutObject}->Block(
                     Name => 'CertificateRead',
---------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.