From: rettenbe Date: Thu, 4 Sep 2008 09:01:46 +0000 (+0000) Subject: bugfix: incoming msg with server mac address are now handled appropriatly X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=76919606c9513f0c5582742a8672c10fd9cef07d;p=gosa.git bugfix: incoming msg with server mac address are now handled appropriatly git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12361 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 0155f08b8..e2ca1c36d 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1057,12 +1057,24 @@ sub msg_to_decrypt { my $not_found_in_known_server_db = 0; my $not_found_in_foreign_clients_db = 0; my $local_address; + my $local_mac; my ($target_ip, $target_port) = split(':', $target); + + # Determine the local ip address if target is an ip address if ($target =~ /^\d+\.\d+\.\d+\.\d+:\d+$/) { $local_address = &get_local_ip_for_remote_ip($target_ip).":$server_port"; } else { $local_address = $server_address; } + + # Determine the local mac address if target is a mac address + if ($target =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i) { + my $loc_ip = &get_local_ip_for_remote_ip($heap->{'remote_ip'}); + my $network_interface= &get_interface_for_ip($loc_ip); + $local_mac = &get_mac_for_interface($network_interface); + } else { + $local_mac = $server_mac_address; + } # target and source is equal to GOSA -> process here if (not $done) { @@ -1073,7 +1085,7 @@ sub msg_to_decrypt { # target is own address without forward_to_gosa-tag -> process here if (not $done) { - if (($target eq $local_address) && (not exists $msg_hash->{'forward_to_gosa'})) { + if ((($target eq $local_address) || ($target eq $local_mac) ) && (not exists $msg_hash->{'forward_to_gosa'})) { $done = 1; if ($source eq "GOSA") { $msg =~ s/<\/xml>/$local_address,$session_id<\/forward_to_gosa><\/xml>/; @@ -1106,7 +1118,7 @@ sub msg_to_decrypt { my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; my $gosa_at; my $gosa_session_id; - if (($target eq $local_address) && (defined $forward_to_gosa)){ + if ((($target eq $local_address) || ($target eq $local_mac) ) && (defined $forward_to_gosa)){ my ($gosa_at, $gosa_session_id) = split(/,/, $forward_to_gosa); if ($gosa_at ne $local_address) { $done = 1; @@ -1139,7 +1151,7 @@ sub msg_to_decrypt { my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; my $gosa_at; my $gosa_session_id; - if (($target eq $local_address) && (defined $forward_to_gosa)){ + if ((($target eq $local_address) || ($target eq $local_mac) ) && (defined $forward_to_gosa)){ my ($gosa_at, $gosa_session_id) = split(/,/, $forward_to_gosa); if ($gosa_at eq $local_address) { my $session_reference = $kernel->ID_id_to_session($gosa_session_id); @@ -1187,7 +1199,7 @@ sub msg_to_decrypt { # target is a server address -> forward to server if (not $done) { - $sql = "SELECT * FROM $known_server_tn WHERE hostname='$target'"; + $sql = "SELECT * FROM $known_server_tn WHERE (hostname='$target' OR macaddress LIKE '$target')"; $res = $known_server_db->select_dbentry($sql); if (keys(%$res) > 0) { my $hostkey = $res->{1}->{'hostkey'}; @@ -1200,7 +1212,6 @@ sub msg_to_decrypt { &send_msg_to_target($msg, $target, $hostkey, $header, $session_id); $done = 1; - #print STDERR "target is a server address -> forward to server\n"; } else { $not_found_in_known_server_db = 1; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index 67e038f14..71d64c2eb 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -77,7 +77,7 @@ for($count = 1; $count <= $zahl; $count++) #$data = "
gosa_get_client_for_login_usr
GOSA GOSA rettenbe
"; # List all si-server providing opsi - #$data = "
gosa_get_hosts_with_module
GOSA 10.89.1.31:20081 opsi_com
"; + #$data = "
gosa_get_hosts_with_module
GOSA 10.3.67.111:20081 mailqueue_com
"; ################## # recreate fai dbs @@ -88,7 +88,8 @@ for($count = 1; $count <= $zahl; $count++) ########### # messaging #$data = "
gosa_send_user_msg
GOSA GOSA ".base64_encode("eine wichtige nachricht")." admin polle harald 20130101235959 ".base64_encode("kaffeepause")."
"; - #$data = "
gosa_send_user_msg
GOSA GOSA ".base64_encode("eine wichtige nachricht")." admin 20130101235959 ".base64_encode("kaffeepause")."
"; + #$data = "
gosa_send_user_msg
00:01:6c:9d:aa:16 GOSA ".base64_encode("eine wichtige nachricht")." admin polle harald 20130101235959 ".base64_encode("kaffeepause")."
"; + #$data = "
gosa_send_user_msg
00:01:6c:9d:b9:fa GOSA ".base64_encode("eine wichtige nachricht")." admin polle harald 20130101235959 ".base64_encode("kaffeepause")."
"; ################ # logHandling.pm