summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: db6dd51)
raw | patch | inline | side by side (parent: db6dd51)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Jul 2008 06:24:24 +0000 (06:24 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Jul 2008 06:24:24 +0000 (06:24 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11637 594d385d-05f5-0310-b6e9-bd551577e9d8
index b4b992156e0a5a058d7c4138416c7240c92f135f..5ccf161195c2c2a0f9dc17d059d1eba3f0c45a31 100644 (file)
my $file1;
my $file2;
open(file1, "> $ldap_config");
-#print STDERR Dumper(PerlIO::get_layers(file1, output => 1));
print file1 "# This file was automatically generated by gosa-si-client. Do not change.\n";
print file1 "URI";
foreach $element (@ldap_uris) {
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 145a82cf848a5381831ae720b8c0be313173ddb0..120be07348b44cd0d7747059ad892a50cd3ef64d 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
{"port" => [\$client_port, "20083"],
"ip" => [\$client_ip, "0.0.0.0"],
"mac-address" => [\$client_mac_address, "00:00:00:00:00:00"],
- "server-domain" => [\$server_domain, ""],
+ "server-domain" => [\$server_domain, ""],
"ldap" => [\$ldap_enabled, 1],
"ldap-config" => [\$ldap_config, "/etc/ldap/ldap.conf"],
"pam-config" => [\$pam_config, "/etc/pam_ldap.conf"],
"nss-config" => [\$nss_config, "/etc/libnss-ldap.conf"],
- "fai-logpath" => [\$fai_logpath, "/var/log/fai/fai.log"],
- "force-hostname" => [\$client_force_hostname, "false"],
+ "fai-logpath" => [\$fai_logpath, "/var/log/fai/fai.log"],
+ "force-hostname" => [\$client_force_hostname, "false"],
},
"server" => {
"ip" => [\$server_ip, "127.0.0.1"],
}
-# moved to GosaSupportDaemon: rettenbe, 19.05.2008
-#sub create_passwd {
-# my $new_passwd = "";
-# for(my $i=0; $i<31; $i++) {
-# $new_passwd .= ("a".."z","A".."Z",0..9)[int(rand(62))]
-# }
-#
-# return $new_passwd;
-#}
-
-
sub create_ciphering {
my ($passwd) = @_;
if((!defined($passwd)) || length($passwd)==0) {
}
-# moved to GosaSupportDaemon: rettenbe: 16.05.2008
-#sub get_server_addresses {
-# my $domain= shift;
-# my @result;
-#
-# my $error = 0;
-# my $res = Net::DNS::Resolver->new;
-# my $query = $res->send("_gosa-si._tcp.".$domain, "SRV");
-# my @hits;
-#
-# if ($query) {
-# foreach my $rr ($query->answer) {
-# push(@hits, $rr->target.":".$rr->port);
-# }
-# }
-# else {
-# #warn "query failed: ", $res->errorstring, "\n";
-# $error++;
-# }
-#
-# if( $error == 0 ) {
-# foreach my $hit (@hits) {
-# my ($hit_name, $hit_port) = split(/:/, $hit);
-# chomp($hit_name);
-# chomp($hit_port);
-#
-# my $address_query = $res->send($hit_name);
-# if( 1 == length($address_query->answer) ) {
-# foreach my $rr ($address_query->answer) {
-# push(@result, $rr->address.":".$hit_port);
-# }
-# }
-# }
-# }
-#
-# return @result;
-#}
-
-
#=== FUNCTION ================================================================
# NAME: send_msg_hash_to_target
# PARAMETERS: msg_hash - hash - xml_hash created with function create_xml_hash
my $ip= &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/));
my $dnsname= gethostbyaddr(inet_aton($ip), AF_INET);
if(!defined($dnsname)) {
- &write_to_file("goto-error-dns:$ip", $fai_logpath);
- exit(1);
+ if( defined($client_force_hostname) && $client_force_hostname eq "true") {
+ $dnsname = `hostname`;
+ } else {
+ &write_to_file("goto-error-dns:$ip", $fai_logpath);
+ exit(1);
+ }
}
# create registration msg
}
-#sub import_events {
-#
-# if (not -e $event_dir) {
-# daemon_log("ERROR: cannot find directory or directory is not readable: $event_dir", 1);
-# }
-# opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
-#
-# while (defined (my $event = readdir (DIR))) {
-# if( $event eq "." || $event eq ".." ) { next; }
-# daemon_log("INFO: found event module: $event", 5);
-# eval{ require $event; };
-# if( $@ ) {
-# daemon_log("ERROR: import of event module '$event' failed", 1);
-# daemon_log("$@", 1);
-# next;
-# }
-#
-# $event =~ /(\S*?).pm$/;
-# my $event_module = $1;
-# my $events_l = eval( $1."::get_events()") ;
-# foreach my $event_name (@{$events_l}) {
-# $event_hash->{$event_name} = $event_module;
-# }
-#
-# }
-#
-# my @all_events = keys %$event_hash;
-# my $all_events_string = join(", ", @all_events);
-#
-# daemon_log("INFO: imported events: $all_events_string", 5);
-#}
-
sub trigger_new_key {
my ($kernel) = $_[KERNEL] ;
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index d73b3c7630b1b65a00ccb0a060de25ce07bba640..250e0080b376831bdaced8405381f5de7cfee7bb 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
}
-# moved to GosaSupportDaemon: 03-06-2008: rettenbe
-#=== FUNCTION ================================================================
-# NAME: get_ip
-# PARAMETERS: interface name (i.e. eth0)
-# RETURNS: (ip address)
-# DESCRIPTION: Uses ioctl to get ip address directly from system.
-#===============================================================================
-#sub get_ip {
-# my $ifreq= shift;
-# my $result= "";
-# my $SIOCGIFADDR= 0x8915; # man 2 ioctl_list
-# my $proto= getprotobyname('ip');
-#
-# socket SOCKET, PF_INET, SOCK_DGRAM, $proto
-# or die "socket: $!";
-#
-# if(ioctl SOCKET, $SIOCGIFADDR, $ifreq) {
-# my ($if, $sin) = unpack 'a16 a16', $ifreq;
-# my ($port, $addr) = sockaddr_in $sin;
-# my $ip = inet_ntoa $addr;
-#
-# if ($ip && length($ip) > 0) {
-# $result = $ip;
-# }
-# }
-#
-# return $result;
-#}
-
-
sub get_local_ip_for_remote_ip {
my $remote_ip= shift;
my $result="0.0.0.0";
sub process_task {
no strict "refs";
+ #CHECK: Not @_[...]?
my ($session, $heap, $task) = @_;
my $error = 0;
my $answer_l;
sub watch_for_done_jobs {
+ #CHECK: $heap for what?
my ($kernel,$heap) = @_[KERNEL, HEAP];
my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((status='done') AND (modified='0'))";
index 0e551f43fbd2aae9433ec59e47b6aef2ceea6445..8d9f6f556963f47f6131534aab2f7f87fffaa359 100644 (file)
return $result;
}
-# moved to GosaSupportDaemon: 03-06-2008: rettenbe
-#=== FUNCTION ================================================================
-# NAME: get_interfaces
-# PARAMETERS: none
-# RETURNS: (list of interfaces)
-# DESCRIPTION: Uses proc fs (/proc/net/dev) to get list of interfaces.
-#===============================================================================
-#sub get_interfaces {
-# my @result;
-# my $PROC_NET_DEV= ('/proc/net/dev');
-#
-# open(PROC_NET_DEV, "<$PROC_NET_DEV")
-# or die "Could not open $PROC_NET_DEV";
-#
-# my @ifs = <PROC_NET_DEV>;
-#
-# close(PROC_NET_DEV);
-#
-# # Eat first two line
-# shift @ifs;
-# shift @ifs;
-#
-# chomp @ifs;
-# foreach my $line(@ifs) {
-# my $if= (split /:/, $line)[0];
-# $if =~ s/^\s+//;
-# push @result, $if;
-# }
-#
-# return @result;
-#}
#=== FUNCTION ================================================================
# NAME: get_mac
return $msg;
}
+# vim:ts=4:shiftwidth:expandtab
1;
index 6487ef1013ea832eacd3a49053cbf71137a6e026..e03bed4d0a30bd2635d57e7ef55bf04864a6a4ea 100644 (file)
sub _ipaddr { join( ".", unpack( "C4", pack( "N", oct( "0x". shift ) ) ) ) }
sub _phys { join( ":", grep {length} split( /(..)/, shift ) ) }
+# vim:ts=4:shiftwidth:expandtab
1;
__END__
index 06b041023b58b6abe106bd91fcc21717bda162f1..f89362a970197978da2dfd7c127c73dc5d7026fc 100644 (file)
my $mesg;
my %cfg_defaults = (
-#"bus" => {
-# "activ" => [\$bus_activ, "on"],
-# "key" => [\$bus_key, ""],
-# "ip" => [\$bus_ip, ""],
-# "port" => [\$bus_port, "20080"],
-# },
"server" => {
"ip" => [\$server_ip, "0.0.0.0"],
"mac-address" => [\$main::server_mac_address, "00:00:00:00:00"],
$main::server_address = $server_address;
-#if( inet_aton($bus_ip) ){ $bus_ip = inet_ntoa(inet_aton($bus_ip)); }
-#######################################################
-## to change
-#if( $bus_ip eq "127.0.1.1" ) { $bus_ip = "127.0.0.1" }
-#######################################################
-#my $bus_address = "$bus_ip:$bus_port";
-#$main::bus_address = $bus_address;
-
-
-#my $hostkey = &create_passwd;
-#my $res = $main::known_server_db->add_dbentry( {table=>$main::known_server_tn,
-# primkey=>['hostname'],
-# hostname=>$main::server_address,
-# status=>'myself',
-# hostkey=>$hostkey,
-# timestamp=>&get_time(),
-# } );
-#if (not $res == 0) {
-# &main::daemon_log("0 ERROR: cannot add server to known_server_db: $res", 1);
-#} else {
-# &main::daemon_log("0 INFO: '$main::server_address' successfully added to known_server_db", 5);
-#}
-
-
-
-## create general settings for this module
-#my $xml = new XML::Simple();
-#
-## register at bus
-#if ($main::no_bus > 0) {
-# $bus_activ = "off"
-#}
-#if($bus_activ eq "on") {
-# ®ister_at_bus();
-#}
-
-
### functions #################################################################
}
-# moved to GosaSupportDaemon: 03-06-2008 rettenbe
-#=== FUNCTION ================================================================
-# NAME: get_interface_for_ip
-# PARAMETERS: ip address (i.e. 192.168.0.1)
-# RETURNS: array: list of interfaces if ip=0.0.0.0, matching interface if found, undef else
-# DESCRIPTION: Uses proc fs (/proc/net/dev) to get list of interfaces.
-#===============================================================================
-#sub get_interface_for_ip {
-# my $result;
-# my $ip= shift;
-# if ($ip && length($ip) > 0) {
-# my @ifs= &get_interfaces();
-# if($ip eq "0.0.0.0") {
-# $result = "all";
-# } else {
-# foreach (@ifs) {
-# my $if=$_;
-# if(&main::get_ip($if) eq $ip) {
-# $result = $if;
-# }
-# }
-# }
-# }
-# return $result;
-#}
-
-# moved to GosaSupportDaemon: 03-06-2008 rettenbe
-#=== FUNCTION ================================================================
-# NAME: get_interfaces
-# PARAMETERS: none
-# RETURNS: (list of interfaces)
-# DESCRIPTION: Uses proc fs (/proc/net/dev) to get list of interfaces.
-#===============================================================================
-#sub get_interfaces {
-# my @result;
-# my $PROC_NET_DEV= ('/proc/net/dev');
-#
-# open(PROC_NET_DEV, "<$PROC_NET_DEV")
-# or die "Could not open $PROC_NET_DEV";
-#
-# my @ifs = <PROC_NET_DEV>;
-#
-# close(PROC_NET_DEV);
-#
-# # Eat first two line
-# shift @ifs;
-# shift @ifs;
-#
-# chomp @ifs;
-# foreach my $line(@ifs) {
-# my $if= (split /:/, $line)[0];
-# $if =~ s/^\s+//;
-# push @result, $if;
-# }
-#
-# return @result;
-#}
#=== FUNCTION ================================================================
# NAME: get_mac
}
-#=== FUNCTION ================================================================
-# NAME: register_at_bus
-# PARAMETERS: nothing
-# RETURNS: nothing
-# DESCRIPTION: creates an entry in known_daemons and send a 'here_i_am' msg to bus
-#===============================================================================
-#sub register_at_bus {
-#
-# # add bus to known_server_db
-# my $res = $main::known_server_db->add_dbentry( {table=>'known_server',
-# primkey=>['hostname'],
-# hostname=>$bus_address,
-# status=>'bus',
-# hostkey=>$bus_key,
-# timestamp=>&get_time,
-# } );
-# my $msg_hash = &create_xml_hash("here_i_am", $server_address, $bus_address);
-# my $msg = &create_xml_string($msg_hash);
-#
-# &main::send_msg_to_target($msg, $bus_address, $bus_key, "here_i_am");
-# return $msg;
-#}
-
-
-
-# outcommented from rettenbe: moved to GosaSupportDaemon.pm
-#sub import_events {
-# if (not -e $event_dir) {
-# &main::daemon_log("S ERROR: cannot find directory or directory is not readable: $event_dir", 1);
-# }
-# opendir (DIR, $event_dir) or die "ERROR while loading gosa-si-events from directory $event_dir : $!\n";
-#
-# while (defined (my $event = readdir (DIR))) {
-# if( $event eq "." || $event eq ".." ) { next; }
-# if( $event eq "gosaTriggered.pm" ) { next; } # only GOsa specific events
-#
-# eval{ require $event; };
-# if( $@ ) {
-# &main::daemon_log("S ERROR: import of event module '$event' failed", 1);
-# &main::daemon_log("$@", 8);
-# next;
-# }
-#
-# $event =~ /(\S*?).pm$/;
-# my $event_module = $1;
-# my $events_l = eval( $1."::get_events()") ;
-# foreach my $event_name (@{$events_l}) {
-# $event_hash->{$event_name} = $event_module;
-# }
-# my $events_string = join( ", ", @{$events_l});
-# &main::daemon_log("S DEBUG: ClientPackages imported events $events_string", 8);
-# }
-#}
-
-
#=== FUNCTION ================================================================
# NAME: process_incoming_msg
# PARAMETERS: crypted_msg - string - incoming crypted message
# DESCRIPTION: process this incoming message
#===============================================================================
sub here_i_am {
- my ($msg, $msg_hash, $session_id) = @_;
+ my ($heap, $msg, $msg_hash, $session_id) = @_[HEAP, ARG0, ARG1, ARG2];
my @out_msg_l;
my $out_hash;
my $source = @{$msg_hash->{source}}[0];
my $client_revision = @{$msg_hash->{client_revision}}[0];
my $key_lifetime = @{$msg_hash->{key_lifetime}}[0];
+ # Move forced hostname to heap - if used
+ if ( defined($msg_hash->{'force-hostname'}[0]) &&
+ length($msg_hash->{'force-hostname'}[0]) > 0){
+ $heap->{force-hostname}->{$mac_address}= $msg_hash->{'force-hostname'}[0];
+ } else {
+ $heap->{force-hostname}->{$mac_address}= undef;
+ }
+
# number of known clients
my $nu_clients= $main::known_clients_db->count_dbentries('known_clients');
return $result;
}
+# vim:ts=4:shiftwidth:expandtab
1;
index 88b2c60eaf1cec4108165a756c2a5d7a451d80d2..ae94225520dbe79d3449fec53d9d05e68e85c6b2 100644 (file)
}
-#############################################
-# moved from gosa-si-client: rettenbe, 16.05.2008
-# outcommented at gosa-si-client
sub get_server_addresses {
my $domain= shift;
my @result;
index 8d165d92354a5b5b3cbddda58e4702ab8ccce4ec..b33a4987953a2882324e6de02cf92f50cc7757d2 100644 (file)
use GOSA::GosaSupportDaemon;
use Data::Dumper;
-#use IO::Socket::INET;
-#use XML::Simple;
-#use Data::Dumper;
-#use NetAddr::IP;
-#use Net::LDAP;
-#use Socket;
-#use Net::hostent;
-
my $event_dir = "/usr/lib/gosa-si/server/ServerPackages";
use lib "/usr/lib/gosa-si/server/ServerPackages";
index 7694b19103628a0d084cbdc46081249132a78483..4cab907882a7b24bbfed00647c8331795a134fd3 100644 (file)
sub detected_hardware {
- my ($msg, $msg_hash, $session_id) = @_ ;
+ my ($heap, $msg, $msg_hash, $session_id) = @_[HEAP, ARG0, ARG1, ARG2];
my $address = $msg_hash->{source}[0];
my $header = $msg_hash->{header}[0];
my $gotoHardwareChecksum= $msg_hash->{detected_hardware}[0]->{gotoHardwareChecksum};
&main::daemon_log("INFO: Need to create a new LDAP Entry for client $address", 4);
my $ipaddress= $1 if $address =~ /^([0-9\.]*?):.*$/;
my $dnsname;
- if (defined($msg_hash->{'force-hostname'}) &&
- defined($msg_hash->{'force-hostname'}[0]) &&
- length($msg_hash->{'force-hostname'}[0]) > 0){
- $dnsname= $msg_hash->{'force-hostname'}[0];
+ if ( defined($heap->{force-hostname}->{$macaddress}) ){
+ $dnsname= $heap->{force-hostname}->{$macaddress};
&main::daemon_log("INFO: Using forced hostname $dnsname for client $address", 4);
} else {
$dnsname= gethostbyaddr(inet_aton($ipaddress), AF_INET) || $ipaddress;
return ;
}
-
-# moved to server_server_com.pm: rettenbe 30.06.2008
-#sub trigger_wake {
-# my ($msg, $msg_hash, $session_id) = @_ ;
-#
-# foreach (@{$msg_hash->{macAddress}}){
-# &main::daemon_log("$session_id INFO: trigger wake for $_", 5);
-# my $host = $_;
-# my $ipaddr = '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 {
-# &main::daemon_log("$session_id ERROR: trigger_wake called with non mac address", 1);
-# }
-#
-# # 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);
-# $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;
-# }
-#
-# return;
-#}
-
1;