[otrs-cvs] CVS: otrs/Kernel/Output/HTML PreferencesPGP.pm,1.2,1.3
cvs-log at otrs.org
cvs-log at otrs.org
Tue Aug 16 20:31:30 CEST 2005
Update of /home/cvs/otrs/Kernel/Output/HTML
In directory osser:/tmp/cvs-serv13870
Modified Files:
PreferencesPGP.pm
Log Message:
Fixed error when downloading PGP keys in customer preferences (Bug #847)
Index: PreferencesPGP.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Output/HTML/PreferencesPGP.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** PreferencesPGP.pm 27 Mar 2005 11:40:34 -0000 1.2
--- PreferencesPGP.pm 16 Aug 2005 17:31:28 -0000 1.3
***************
*** 93,97 ****
}
}
! print STDERR "$UploadStuff{Filename}, ------------\n";
# $Self->{UserObject}->SetPreferences(
# UserID => $Param{UserData}->{UserID},
--- 93,97 ----
}
}
!
# $Self->{UserObject}->SetPreferences(
# UserID => $Param{UserData}->{UserID},
***************
*** 101,112 ****
$Self->{UserObject}->SetPreferences(
UserID => $Param{UserData}->{UserID},
! Key => "PGPFilename",
! Value => $UploadStuff{Filename},
);
$Self->{UserObject}->SetPreferences(
UserID => $Param{UserData}->{UserID},
! Key => "PGPContentType",
! Value => $UploadStuff{ContentType},
);
$Self->{Message} = $Message;
return 1;
--- 101,117 ----
$Self->{UserObject}->SetPreferences(
UserID => $Param{UserData}->{UserID},
! Key => "PGPKeyID", # new parameter PGPKeyID
! Value => $1, # write KeyID on a per user base
);
$Self->{UserObject}->SetPreferences(
UserID => $Param{UserData}->{UserID},
! Key => "PGPFilename",
! Value => $UploadStuff{Filename},
);
+ # $Self->{UserObject}->SetPreferences(
+ # UserID => $Param{UserData}->{UserID},
+ # Key => "PGPContentType",
+ # Value => $UploadStuff{ContentType},
+ # );
$Self->{Message} = $Message;
return 1;
***************
*** 116,123 ****
my $Self = shift;
my %Param = @_;
return (
! Content => 123,
! ContentType => ,
! Filename => ,
);
}
--- 121,169 ----
my $Self = shift;
my %Param = @_;
+
+ my %Preferences = ();
+
+ my $UserID = $Param{UserData}->{UserID};
+ my $KeyID = undef;
+ my $KeyString = undef;
+ my $FileName = undef;
+
+ my $CryptObject = Kernel::System::Crypt->new(
+ LogObject => $Self->{LogObject},
+ DBObject => $Self->{DBObject},
+ ConfigObject => $Self->{ConfigObject},
+ CryptType => 'PGP',
+ );
+ if (!$CryptObject) {
+ return 1;
+ }
+
+ # get preferences with key parameters
+ %Preferences = $Self->{UserObject}->GetPreferences(UserID => $UserID);
+ # get key related stuff
+ $KeyID = $Preferences{'PGPKeyID'};
+ $FileName = $Preferences{'PGPFilename'};
+ if ((! defined $KeyID) || ($KeyID eq '')) {
+ $Self->{LogObject}->Log(
+ Priority => 'Error',
+ Message => 'Need KeyID to get pgp public key of '.$UserID,
+ );
+ }
+
+ else {
+ $KeyString = $CryptObject->PublicKeyGet(Key => $KeyID);
+ }
+
+ if ((! defined $KeyString) || ($KeyString eq '')) {
+ $Self->{LogObject}->Log(
+ Priority => 'Error',
+ Message => 'Couldn\'t get ASCII exported pubKey for KeyID '.$KeyID,
+ );
+ }
+
return (
! ContentType => 'text/plain',
! Content => $KeyString,
! Filename => ($FileName?$UserID.'_'.$FileName:'pgp.asc'),
);
}
More information about the cvs-log
mailing list