From: rettenbe Date: Fri, 7 Nov 2008 13:16:48 +0000 (+0000) Subject: new perl module used to create random file in /tmp X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9d4924a2259e6f80b48285e9b953e119b9fdbc85;p=gosa.git new perl module used to create random file in /tmp git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@12966 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/gosaTriggered.pm b/gosa-si/client/events/gosaTriggered.pm index 6edc2758f..dca6f6308 100644 --- a/gosa-si/client/events/gosaTriggered.pm +++ b/gosa-si/client/events/gosaTriggered.pm @@ -50,7 +50,7 @@ use warnings; use GOSA::GosaSupportDaemon; use Data::Dumper; use MIME::Base64; -use Data::Random qw(:all); +use File::Temp qw/ tempfile/; BEGIN {} @@ -126,10 +126,9 @@ sub usr_msg { my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]); my $message = &decode_base64(@{$msg_hash->{'message'}}[0]); - my $rand_file = "/tmp/goto_notify_".join("",rand_chars(set=>'alphanumeric', min=>16, max=>16)); - open(DATEI, ">$rand_file"); - print DATEI "source:$source\ntarget:$target\nusr:$to\nsubject:".@{$msg_hash->{'subject'}}[0]."\nmessage:".@{$msg_hash->{'message'}}[0]."\n"; - close DATEI; + my ($rand_fh, $rand_file) = tempfile( SUFFIX => '.goto_notify'); + print $rand_fh "source:$source\ntarget:$target\nusr:$to\nsubject:".@{$msg_hash->{'subject'}}[0]."\nmessage:".@{$msg_hash->{'message'}}[0]."\n"; + close $rand_fh; my $feedback = system("/usr/bin/goto-notify user-message '$to' '$subject' '$message' '$rand_file' &" );