summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 12b8221)
raw | patch | inline | side by side (parent: 12b8221)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Feb 2008 11:06:25 +0000 (11:06 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Feb 2008 11:06:25 +0000 (11:06 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9126 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 9aaa5db31995657ab6f0fb7189b88af297bcc3a0..9838f476eafb7132a4b57112fe5273309be86d85 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
}
close( LOG_HANDLE );
}
-#log into syslog
-# my ($msg, $level, $facility) = @_;
-# if(not defined $msg) {return}
-# if(not defined $level) {$level = "info"}
-# if(not defined $facility) {$facility = "LOG_DAEMON"}
-# openlog($0, "pid,cons,", $facility);
-# syslog($level, $msg);
-# closelog;
-# return;
}
}
}
-# my $dig_cmd= 'dig +nocomments srv _gosa-si._tcp.'.$domain;
-#
-# my $output= `$dig_cmd 2>&1`;
-# open (PIPE, "$dig_cmd 2>&1 |");
-# while(<PIPE>) {
-# chomp $_;
-# # If it's not a comment
-# if($_ =~ m/^[^;]/) {
-# my @matches= split /\s+/;
-#
-# # Push hostname with port
-# if($matches[3] eq 'SRV') {
-# push @result, $matches[7].':'.$matches[6];
-# } elsif ($matches[3] eq 'A') {
-# my $i=0;
-#
-# # Substitute the hostname with the ip address of the matching A record
-# foreach my $host (@result) {
-# if ((split /\:/, $host)[0] eq $matches[0]) {
-# $result[$i]= $matches[4].':'.(split /\:/, $host)[1];
-# }
-# $i++;
-# }
-# }
-# }
-# }
-# close(PIPE);
return @result;
}
-##=== FUNCTION ================================================================
-## NAME: create_ciphering
-## PARAMETERS: passwd - string - used to create ciphering
-## RETURNS: cipher - object
-## DESCRIPTION: creates a Crypt::Rijndael::MODE_CBC object with passwd as key
-##===============================================================================
-#sub create_ciphering {
-# my ($passwd) = @_;
-# $passwd = substr(md5_hex("$passwd") x 32, 0, 32);
-# my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
-#
-# #daemon_log("iv: $iv", 7);
-# #daemon_log("key: $passwd", 7);
-# my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC());
-# $my_cipher->set_iv($iv);
-# return $my_cipher;
-#}
-#
-#
-#sub create_ciphering {
-# my ($passwd) = @_;
-# $passwd = substr(md5_hex("$passwd") x 32, 0, 32);
-# my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
-# my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC());
-# $my_cipher->set_iv($iv);
-# return $my_cipher;
-#}
-#
-#
-#sub encrypt_msg {
-# my ($msg, $key) = @_;
-# my $my_cipher = &create_ciphering($key);
-# {
-# use bytes;
-# $msg = "\0"x(16-length($msg)%16).$msg;
-# }
-# $msg = $my_cipher->encrypt($msg);
-# chomp($msg = &encode_base64($msg));
-# # there are no newlines allowed inside msg
-# $msg=~ s/\n//g;
-# return $msg;
-#}
-#
-#
-#sub decrypt_msg {
-# my ($msg, $key) = @_ ;
-# $msg = &decode_base64($msg);
-# my $my_cipher = &create_ciphering($key);
-# $msg = $my_cipher->decrypt($msg);
-# $msg =~ s/\0*//g;
-# return $msg;
-#}
-
-
#=== FUNCTION ================================================================
# NAME: send_msg_hash_to_target
# PARAMETERS: msg_hash - hash - xml_hash created with function create_xml_hash
system('rm -f /tmp/gosa_si_lock*gosa-si-client*');
# detect ip and mac address and complete host address
-#if( inet_aton($client_ip) ){
-#print STDERR "ip: $client_ip\n";
-# $client_ip = inet_ntoa(inet_aton($client_ip));
-#print STDERR "ip: $client_ip\n";
-#}
$client_address = $client_ip.":".$client_port;
my $network_interface= &get_interface_for_ip($client_ip);
$client_mac_address= &get_mac($network_interface);
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 7851f24ae1647108d548f00c4a585fb0368d26aa..4086f6b247210ebbe57763c92e5752d2dcf2a431 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
}
close( LOG_HANDLE );
}
-#log into syslog
-# my ($msg, $level, $facility) = @_;
-# if(not defined $msg) {return}
-# if(not defined $level) {$level = "info"}
-# if(not defined $facility) {$facility = "LOG_DAEMON"}
-# openlog($0, "pid,cons,", $facility);
-# syslog($level, $msg);
-# closelog;
-# return;
}
index 93261ef91b5946c19fde6ceb9229a57cf38b0292..9a4b6657a07ea15af431a7288dedd4f1d7fc493a 100644 (file)
base => $sub_tree,
filter => $search_string,
) or &main::daemon_log("cannot perform search at ldap: $@", 1);
- #if(defined $msg) {
- # print $sub_tree."\t".$search_string."\t";
- # print $msg->count."\n";
- # foreach my $entry ($msg->entries) { $entry->dump; };
- #}
}
return $msg;
}
-# $ldap = Net::LDAP->new( "localhost" ) or die "$@";
-# $ldap->bind($bind_phrase,
-# password => $password,
-# ) ;
-#
-# switch($arp_sig) {
-# case 0 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "ip-changed",
-# )}
-# case 1 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "mac-not-whitelisted",
-# )}
-# case 2 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "mac-in-blacklist",
-# )}
-# case 3 {&add_ldap_entry($ldap, $ldap_base,
-# $mac, "new-mac-address", $ip,
-# $interface, $desc,
-# )}
-# case 4 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "unauthorized-arp-request",
-# )}
-# case 5 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "abusive-number-of-arp-requests",
-# )}
-# case 6 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "ether-and-arp-mac-differs",
-# )}
-# case 7 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "flood-detected",
-# )}
-# case 8 {&add_ldap_entry($ldap, $ldap_base,
-# $mac, $ip, "new-system",
-# )}
-# case 9 {&change_ldap_entry($ldap, $ldap_base,
-# $mac, "mac-changed",
-# )}
-# }
-#
-#
- # ldap search
-# my $base_phrase = "dc=gonicus,dc=de";
-# my $filter_phrase = "cn=keinesorge";
-# my $attrs_phrase = "cn macAdress";
-# my $msg_search = $ldap->search( base => $base_phrase,
-# filter => $filter_phrase,
-# attrs => $attrs_phrase,
-# );
-# $msg_search->code && die $msg_search->error;
-#
-# my @entries = $msg_search->entries;
-# my $max = $msg_search->count;
-# print "anzahl der entries: $max\n";
-# my $i;
-# for ( $i = 0 ; $i < $max ; $i++ ) {
-# my $entry = $msg_search->entry ( $i );
-# foreach my $attr ( $entry->attributes ) {
-# if( not $attr eq "cn") {
-# next;
-# }
-# print join( "\n ", $attr, $entry->get_value( $attr ) ), "\n\n";
-# }
-# }
- #
- # # ldap add
- #
- #
- # $ldap->unbind;
- # exit;
1;
index cc58491b87c6d3cb465b942dc4c98278f948a429..5e6baca9ed67b0099b07490e5cb61513180b29b9 100644 (file)
}
-#=== FUNCTION ================================================================
-# NAME: encrypt_msg
-# PARAMETERS: msg - string - message to encrypt
-# my_cipher - ref - reference to a Crypt::Rijndael object
-# RETURNS: crypted_msg - string - crypted message
-# DESCRIPTION: crypts the incoming message with the Crypt::Rijndael module
-#===============================================================================
-#sub encrypt_msg {
-# my ($msg, $key) = @_;
-# my $my_cipher = &create_ciphering($key);
-# {
-# use bytes;
-# $msg = "\0"x(16-length($msg)%16).$msg;
-# }
-# $msg = $my_cipher->encrypt($msg);
-# chomp($msg = &encode_base64($msg));
-# # there are no newlines allowed inside msg
-# $msg=~ s/\n//g;
-# return $msg;
-#}
-
-
-#=== FUNCTION ================================================================
-# NAME: decrypt_msg
-# PARAMETERS: crypted_msg - string - message to decrypt
-# my_cipher - ref - reference to a Crypt::Rijndael object
-# RETURNS: msg - string - decrypted message
-# DESCRIPTION: decrypts the incoming message with the Crypt::Rijndael module
-#===============================================================================
-#sub decrypt_msg {
-# my ($msg, $my_cipher) = @_ ;
-#
-# if(defined $msg && defined $my_cipher) {
-# $msg = &decode_base64($msg);
-# }
-# $msg = $my_cipher->decrypt($msg);
-# $msg =~ s/\0*//g;
-# return $msg;
-# my ($msg, $key) = @_ ;
-# $msg = &decode_base64($msg);
-# my $my_cipher = &create_ciphering($key);
-# $msg = $my_cipher->decrypt($msg);
-# $msg =~ s/\0*//g;
-# return $msg;
-#}
-
-
-#=== FUNCTION ================================================================
-# NAME: create_ciphering
-# PARAMETERS: passwd - string - used to create ciphering
-# RETURNS: cipher - object
-# DESCRIPTION: creates a Crypt::Rijndael::MODE_CBC object with passwd as key
-#===============================================================================
-#sub create_ciphering {
-# my ($passwd) = @_;
-# $passwd = substr(md5_hex("$passwd") x 32, 0, 32);
-# my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
-#
-# #daemon_log("iv: $iv", 7);
-# #daemon_log("key: $passwd", 7);
-# my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC());
-# $my_cipher->set_iv($iv);
-# return $my_cipher;
-#}
-
-
-#=== FUNCTION ================================================================
-# NAME: open_socket
-# PARAMETERS: PeerAddr string something like 192.168.1.1 or 192.168.1.1:10000
-# [PeerPort] string necessary if port not appended by PeerAddr
-# RETURNS: socket IO::Socket::INET
-# DESCRIPTION: open a socket to PeerAddr
-#===============================================================================
-#sub open_socket {
-# my ($PeerAddr, $PeerPort) = @_ ;
-# if(defined($PeerPort)){
-# $PeerAddr = $PeerAddr.":".$PeerPort;
-# }
-# my $socket;
-# $socket = new IO::Socket::INET(PeerAddr => $PeerAddr,
-# Porto => "tcp",
-# Type => SOCK_STREAM,
-# Timeout => 5,
-# );
-# if(not defined $socket) {
-# return;
-# }
-# &daemon_log("open_socket: $PeerAddr", 7);
-# return $socket;
-#}
-
-
sub get_time {
my ($seconds, $minutes, $hours, $monthday, $month,
$year, $weekday, $yearday, $sommertime) = localtime(time);
index c0d4ccbd4c700ae43921261bb87cb80138b72abb..492b109a006bb5294b4c51e0050bf481fe1fc573 100644 (file)
}
-#sub daemon_log {
-# my ($msg, $level) = @_ ;
-# &main::daemon_log($msg, $level);
-# return;
-#}
-#
-
-#sub do_wake {
-# my $host = shift;
-# my $ipaddr = shift || '255.255.255.255';
-# my $port = getservbyname('discard', 'udp');
-#
-# my ($raddr, $them, $proto);
-# my ($hwaddr, $hwaddr_re, $pkt);
-#
-# # get the hardware address (ethernet address)
-#
-# $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
-# if ($host =~ m/^$hwaddr_re$/) {
-# $hwaddr = $host;
-# } else {
-# # $host is not a hardware address, try to resolve it
-# my $ip_re = join('\.', ('([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))') x 4);
-# my $ip_addr;
-# if ($host =~ m/^$ip_re$/) {
-# $ip_addr = $host;
-# } else {
-# my $h;
-# unless ($h = gethost($host)) {
-# return undef;
-# }
-# $ip_addr = inet_ntoa($h->addr);
-# }
-# }
-#
-# # Generate magic sequence
-# foreach (split /:/, $hwaddr) {
-# $pkt .= chr(hex($_));
-# }
-# $pkt = chr(0xFF) x 6 . $pkt x 16;
-#
-# # Allocate socket and send packet
-#
-# $raddr = gethostbyname($ipaddr)->addr;
-# $them = pack_sockaddr_in($port, $raddr);
-# $proto = getprotobyname('udp');
-#
-# socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
-# setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
-#
-# send(S, $pkt, 0, $them) or die "send : $!";
-# close S;
-#}
-
-
#=== FUNCTION ================================================================
# NAME: read_configfile
# PARAMETERS: cfg_file - string -
}
-#=== FUNCTION ================================================================
-# NAME: got_ping
-# PARAMETERS: msg_hash - hash - hash from function create_xml_hash
-# RETURNS: nothing
-# DESCRIPTION: process this incoming message
-#===============================================================================
-#sub got_ping {
-# my ($msg_hash) = @_;
-#
-# my $source = @{$msg_hash->{source}}[0];
-# my $target = @{$msg_hash->{target}}[0];
-# my $header = @{$msg_hash->{header}}[0];
-# my $session_id = @{$msg_hash->{'session_id'}}[0];
-# my $act_time = &get_time;
-# my @out_msg_l;
-# my $out_msg;
-#
-# # check known_clients_db
-# my $sql_statement = "SELECT * FROM known_clients WHERE hostname='$source'";
-# my $query_res = $main::known_clients_db->select_dbentry( $sql_statement );
-# if( 1 == keys %{$query_res} ) {
-# my $sql_statement= "UPDATE known_clients ".
-# "SET status='$header', timestamp='$act_time' ".
-# "WHERE hostname='$source'";
-# my $res = $main::known_clients_db->update_dbentry( $sql_statement );
-# }
-#
-# # check known_server_db
-# $sql_statement = "SELECT * FROM known_server WHERE hostname='$source'";
-# $query_res = $main::known_server_db->select_dbentry( $sql_statement );
-# if( 1 == keys %{$query_res} ) {
-# my $sql_statement= "UPDATE known_server ".
-# "SET status='$header', timestamp='$act_time' ".
-# "WHERE hostname='$source'";
-# my $res = $main::known_server_db->update_dbentry( $sql_statement );
-# }
-#
-# # create out_msg
-# my $out_hash = &create_xml_hash($header, $source, "GOSA");
-# &add_content2xml_hash($out_hash, "session_id", $session_id);
-# $out_msg = &create_xml_string($out_hash);
-# push(@out_msg_l, $out_msg);
-#
-# return @out_msg_l;
-#}
-
#=== FUNCTION ================================================================
# NAME: new_passwd
# PARAMETERS: msg_hash - ref - hash from function create_xml_hash
}
}
}
- # need to fill it to LDAP
- #$entry->add(gotoHardwareChecksum => $gotoHardwareChecksum);
- #if($entry->update($ldap)) {
- # &main::daemon_log("gotoHardwareChecksum $gotoHardwareChecksum was added to LDAP", 4);
- #}
-
- ## Look if there another host with this checksum to use the hardware config
- #$mesg = $ldap->search(
- # base => $ldap_base,
- # scope => 'sub',
- # filter => "(&(objectClass=GOhard)(gotoHardwareChecksum=$gotoHardwareChecksum))"
- #);
-
- #if($mesg->count>1) {
- # my $clone_entry= $mesg->entry(0);
- # $entry->changetype("modify");
- # foreach my $attribute (
- # "gotoSndModule", "ghNetNic", "gotoXResolution", "ghSoundAdapter", "ghCpuType", "gotoXkbModel",
- # "ghGfxAdapter", "gotoXMousePort", "ghMemSize", "gotoXMouseType", "ghUsbSupport", "gotoXHsync",
- # "gotoXDriver", "gotoXVsync", "gotoXMonitor") {
- # my $value= $clone_entry->get_value($attribute);
- # if(defined($value)) {
- # if(defined($entry->get_value($attribute))) {
- # $entry->delete($attribute);
- # }
- # &main::daemon_log("Adding attribute $attribute with value $value",1);
- # $entry->add($attribute => $value);
- # }
- # }
- # foreach my $attribute (
- # "gotoModules", "ghScsiDev", "ghIdeDev") {
- # my $array= $clone_entry->get_value($attribute, 'as_ref' => 1);
- # if(defined($array)) {
- # if(defined($entry->get_value($attribute))) {
- # $entry->delete($attribute);
- # }
- # foreach my $array_entry (@{$array}) {
- # $entry->add($attribute => $array_entry);
- # }
- # }
-
- # }
- # if($entry->update($ldap)) {
- # &main::daemon_log("Added Hardware configuration to LDAP", 4);
- # }
-
- #}
-
# Assemble data package
my %data = ();
return $result;
}
-
-##=== FUNCTION ================================================================
-## NAME: execute_actions
-## PARAMETERS: msg_hash - hash - hash from function create_xml_hash
-## RETURNS: nothing
-## DESCRIPTION: invokes the script specified in msg_hash which is located under
-## /etc/gosad/actions
-##===============================================================================
-#sub execute_actions {
-# my ($msg_hash) = @_ ;
-# my $configdir= '/etc/gosad/actions/';
-# my $result;
-#
-# my $header = @{$msg_hash->{header}}[0];
-# my $source = @{$msg_hash->{source}}[0];
-# my $target = @{$msg_hash->{target}}[0];
-#
-# if((not defined $source)
-# && (not defined $target)
-# && (not defined $header)) {
-# &main::daemon_log("ERROR: Entries missing in XML msg for gosad actions under /etc/gosad/actions");
-# } else {
-# my $parameters="";
-# my @params = @{$msg_hash->{$header}};
-# my $params = join(", ", @params);
-# &main::daemon_log("execute_actions: got parameters: $params", 5);
-#
-# if (@params) {
-# foreach my $param (@params) {
-# my $param_value = (&get_content_from_xml_hash($msg_hash, $param))[0];
-# &main::daemon_log("execute_actions: parameter -> value: $param -> $param_value", 7);
-# $parameters.= " ".$param_value;
-# }
-# }
-#
-# my $cmd= $configdir.$header."$parameters";
-# &main::daemon_log("execute_actions: executing cmd: $cmd", 7);
-# $result= "";
-# open(PIPE, "$cmd 2>&1 |");
-# while(<PIPE>) {
-# $result.=$_;
-# }
-# close(PIPE);
-# }
-#
-# # process the event result
-#
-#
-# return;
-#}
-#
-
1;