summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5ea5085)
raw | patch | inline | side by side (parent: 5ea5085)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 14:56:52 +0000 (14:56 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 May 2008 14:56:52 +0000 (14:56 +0000) |
* under construction
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11112 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11112 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/gosa-si-server-nobus | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 3f438595316ce7303b77f7d5029e9a993242ffa9..df75a81e132eb39d4bac2be1406c9428cf0a1f02 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
# DESCRIPTION:
#===============================================================================
sub daemon_log {
- # log into log_file
+# log into log_file
my( $msg, $level ) = @_;
if(not defined $msg) { return }
if(not defined $level) { $level = 1 }
chmod 0600, $log_file;
if(not defined open( LOG_HANDLE, ">>$log_file" )) {
print STDERR "cannot open $log_file: $!";
- return }
- chomp($msg);
- if($level <= $verbose){
- my ($seconds, $minutes, $hours, $monthday, $month,
- $year, $weekday, $yearday, $sommertime) = localtime(time);
- $hours = $hours < 10 ? $hours = "0".$hours : $hours;
- $minutes = $minutes < 10 ? $minutes = "0".$minutes : $minutes;
- $seconds = $seconds < 10 ? $seconds = "0".$seconds : $seconds;
- my @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
- $month = $monthnames[$month];
- $monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
- $year+=1900;
-
- my $log_msg = "$month $monthday $hours:$minutes:$seconds $prg $msg\n";
- print LOG_HANDLE $log_msg;
- if( $foreground ) {
- print STDERR $log_msg;
- }
+ return
+ }
+ chomp($msg);
+ if($level <= $verbose){
+ my ($seconds, $minutes, $hours, $monthday, $month,
+ $year, $weekday, $yearday, $sommertime) = localtime(time);
+ $hours = $hours < 10 ? $hours = "0".$hours : $hours;
+ $minutes = $minutes < 10 ? $minutes = "0".$minutes : $minutes;
+ $seconds = $seconds < 10 ? $seconds = "0".$seconds : $seconds;
+ my @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
+ $month = $monthnames[$month];
+ $monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
+ $year+=1900;
+
+ my $log_msg = "$month $monthday $hours:$minutes:$seconds $prg $msg\n";
+ print LOG_HANDLE $log_msg;
+ if( $foreground ) {
+ print STDERR $log_msg;
}
+ }
close( LOG_HANDLE );
}
}
# encrypt xml msg
my $crypted_msg = &encrypt_msg($msg, $encrypt_key);
- # xxxxxxxxxxxxxx
-
-
-
# opensocket
my $socket = &open_socket($address);
if( !$socket ) {
daemon_log("ERROR: cannot send ".$msg_header."msg to $address , host not reachable", 1);
- $REGISTERED = 0; # if server is not available, cause reregistering
- #$global_kernel->yield('register_at_gosa_si_server');
+ if ($REGISTERED == 1) {
+ $REGISTERED = 0; # if server is not available, cause reregistering
+ daemon_log("INFO: cause reregistering at gosa-si-server", 5);
+ $global_kernel->yield('register_at_gosa_si_server');
+
+ }
$error++;
}
if( $error == 0 ) {
print $socket $crypted_msg."\n";
daemon_log("INFO: send ".$msg_header."msg to $address", 5);
- daemon_log("DEBUG: message:\n$msg", 8);
+ daemon_log("DEBUG: message:\n$msg", 9);
}
# close socket in any case
my $msg_hash;
eval{
$msg = &decrypt_msg($crypted_msg, $module_key);
- &main::daemon_log("decrypted_msg: \n$msg", 8);
+ &main::daemon_log("decrypted_msg: \n$msg", 9);
$msg_hash = $xml->XMLin($msg, ForceArray=>1);
daemon_log("INFO: Incoming msg from '$remote_ip'", 5);
- daemon_log("DEBUG: Incoming msg:\n$input\n", 8);
+ daemon_log("DEBUG: Incoming msg:\n$input\n", 9);
my ($msg, $msg_hash) = &check_key_and_xml_validity($input, $server_key);
if( (!$msg) || (!$msg_hash) ) {
if( exists $event_hash->{$header} ) {
# a event exists with the header as name
- daemon_log("DEBUG: found event '$header' at event-module '".$event_hash->{$header}."'", 7);
+ daemon_log("INFO: found event '$header' at event-module '".$event_hash->{$header}."'", 5);
no strict 'refs';
$answer = &{$event_hash->{$header}."::$header"}($msg, $msg_hash);
}
else {
- daemon_log("WARNING: no event '$header' found in event modules under $event_dir", 1);
+ daemon_log("WARNING: no event '$header' found in event modules under $event_dir", 3);
}
}
index f46e82691f27025cd738fb97eed54a746194e0d0..624c7b808cd8bed8cf26521d1a7a6c24b8270bce 100755 (executable)
chmod 0600, $log_file;
if(not defined open( LOG_HANDLE, ">>$log_file" )) {
print STDERR "cannot open $log_file: $!";
- return }
- chomp($msg);
- $msg =~s/\n//g; # no newlines are allowed in log messages, this is important for later log parsing
- if($level <= $verbose){
- my ($seconds, $minutes, $hours, $monthday, $month,
- $year, $weekday, $yearday, $sommertime) = localtime(time);
- $hours = $hours < 10 ? $hours = "0".$hours : $hours;
- $minutes = $minutes < 10 ? $minutes = "0".$minutes : $minutes;
- $seconds = $seconds < 10 ? $seconds = "0".$seconds : $seconds;
- my @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
- $month = $monthnames[$month];
- $monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
- $year+=1900;
- my $name = $prg;
-
- my $log_msg = "$month $monthday $hours:$minutes:$seconds $name $msg\n";
- print LOG_HANDLE $log_msg;
- if( $foreground ) {
- print STDERR $log_msg;
- }
+ return
+ }
+ chomp($msg);
+ $msg =~s/\n//g; # no newlines are allowed in log messages, this is important for later log parsing
+ if($level <= $verbose){
+ my ($seconds, $minutes, $hours, $monthday, $month,
+ $year, $weekday, $yearday, $sommertime) = localtime(time);
+ $hours = $hours < 10 ? $hours = "0".$hours : $hours;
+ $minutes = $minutes < 10 ? $minutes = "0".$minutes : $minutes;
+ $seconds = $seconds < 10 ? $seconds = "0".$seconds : $seconds;
+ my @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
+ $month = $monthnames[$month];
+ $monthday = $monthday < 10 ? $monthday = "0".$monthday : $monthday;
+ $year+=1900;
+ my $name = $prg;
+
+ my $log_msg = "$month $monthday $hours:$minutes:$seconds $name $msg\n";
+ print LOG_HANDLE $log_msg;
+ if( $foreground ) {
+ print STDERR $log_msg;
}
+ }
close( LOG_HANDLE );
}
}