summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 231ece5)
raw | patch | inline | side by side (parent: 231ece5)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Nov 2008 15:58:11 +0000 (15:58 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Nov 2008 15:58:11 +0000 (15:58 +0000) |
* another perl module is used to create random files under /tmp
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12974 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12974 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/gosaTriggered.pm | patch | blob | history | |
gosa-si/gosa-si-client | patch | blob | history |
index 6edc2758f383a9b398898e0db87c36770ca19461..dca6f63088b9a377e52069f3d6a7bfc076c4900a 100644 (file)
use GOSA::GosaSupportDaemon;
use Data::Dumper;
use MIME::Base64;
-use Data::Random qw(:all);
+use File::Temp qw/ tempfile/;
BEGIN {}
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' &" );
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 9c7e09e2f793d9df08149138d7b8ef61140956c6..d3965ce3925964bd90237bde5974662ff0fe1fb3 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
my ($fai_log_dir) = @_ ;
my $FAI_DIR;
- opendir($FAI_DIR, $fai_log_dir);
- if (not defined $FAI_DIR) {
- daemon_log("ERROR: can not open directory $fai_log_dir: $!", 1);
+ my $log_dir = File::Spec->catdir($fai_log_dir, "localhost/last");
+
+ if (not -r -d $log_dir) {
+ daemon_log("ERROR: cannot open directory $log_dir", 1);
return;
}
+ opendir($FAI_DIR, "$log_dir");
my @log_files = readdir($FAI_DIR);
closedir($FAI_DIR);
- my @log_list;
+ my @log_list;
foreach my $log_file (@log_files) {
if( $log_file eq "." || $log_file eq ".." ) { next; }
+
my $log = "log_file:$log_file:";
- $log_file = File::Spec->catfile( $fai_log_dir, $log_file );
- open(my $FILE, "<$log_file");
- if (not defined $FILE ) {
- daemon_log("ERROR: can not open '$log_file': $!", 1);
+ $log_file = File::Spec->catfile( $log_dir, $log_file );
+
+ if (not -r -f $log_file) {
+ daemon_log("ERROR: cannot read $log_file", 1);
next;
}
- my @lines = <$FILE>;
- my $log_string = join("", @lines);
- $log .= &encode_base64($log_string);
- push(@log_list, $log);
- close ($FILE);
+
+ if (-r -f $log_file) {
+ open(FILE, "<$log_file");
+ my @lines = <FILE> ;
+ close (FILE);
+ my $log_string = join("", @lines);
+ $log .= &encode_base64($log_string);
+ push(@log_list, $log);
+ }
}
my $all_log_string = join("\n", @log_list);