summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b6a2017)
raw | patch | inline | side by side (parent: b6a2017)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 29 Feb 2008 10:58:48 +0000 (10:58 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 29 Feb 2008 10:58:48 +0000 (10:58 +0000) |
opts-file gets written when client received registration, not when registration message to server has been sended.
LDAP_AVAILABLE="true" gets written to opts file when Ldap configuration for client is available.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9210 594d385d-05f5-0310-b6e9-bd551577e9d8
LDAP_AVAILABLE="true" gets written to opts file when Ldap configuration for client is available.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9210 594d385d-05f5-0310-b6e9-bd551577e9d8
index 074b04f524248e0dccb6fcb5e1e3388c09bde03c..6651fcf5d69570b303b4c8754d929b7c0bcd46f6 100644 (file)
return;
}
-
sub registered {
my ($msg, $msg_hash) = @_ ;
# set registration_flag to true
my $out_hash = &create_xml_hash("registered", $main::client_address, $main::server_address);
+ # Write the MAC address to file
+ if(stat($main::opts_file)) {
+ unlink($main::opts_file);
+ }
+
+ &main::daemon_log(Dumper($msg_hash),1);
+ my $opts_file_FH;
+ my $hostname= $main::client_dnsname;
+ $hostname =~ s/\..*$//;
+ open($opts_file_FH, ">$main::opts_file");
+ print $opts_file_FH "MAC=\"$main::client_mac_address\"\n";
+ print $opts_file_FH "IPADDRESS=\"$main::client_ip\"\n";
+ print $opts_file_FH "HOSTNAME=\"$hostname\"\n";
+ print $opts_file_FH "FQDN=\"$main::client_dnsname\"\n";
+ if(defined(@{$msg_hash->{'ldap_available'}}) &&
+ @{$msg_hash->{'ldap_available'}}[0] eq "true") {
+ print $opts_file_FH "LDAP_AVAILABLE=\"true\"\n";
+ }
+ close($opts_file_FH);
+
my $out_msg = &create_xml_string($out_hash);
return $out_msg;
-
}
-
sub server_leaving {
my ($msg_hash) = @_ ;
my $source = @{$msg_hash->{'source'}}[0];
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 237470160e53564ffc52ed8a4a9d0795c84815ae..afb51ba26278252d4e612aff59ff96e33899348a 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
my $event_dir = "/usr/lib/gosa-si/client/events";
use lib "/usr/lib/gosa-si/client/events";
-my ($cfg_file, %cfg_defaults, $foreground, $verbose, $pid_file, $opts_file, $procid, $pid, $log_file, $fai_logpath);
+my (%cfg_defaults, $foreground, $verbose, $pid_file, $procid, $pid, $log_file, $fai_logpath);
my ($server_ip, $server_port, $server_key, $server_timeout, $server_domain, $server_key_lifetime);
my ($client_ip, $client_port, $client_mac_address, $ldap_enabled, $ldap_config, $pam_config, $nss_config);
my $xml;
# globalise variables which are used in imported events
our $cfg_file;
+our $opts_file;
our $server_address;
our $client_address;
+our $client_ip;
+our $client_mac_address;
+our $client_dnsname;
our $server_key;
# default variables
$client_ip= &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/));
$client_address= "$client_ip:$client_port";
$client_mac_address = $local_mac;
+ $client_dnsname = $dnsname;
- # Write the MAC address to file
- if(stat($opts_file)) {
- unlink($opts_file);
- }
-
- my $opts_file_FH;
- my $hostname= $dnsname;
- $hostname =~ s/\..*$//;
- open($opts_file_FH, ">$opts_file");
- print $opts_file_FH "MAC=\"$local_mac\"\n";
- print $opts_file_FH "IPADDRESS=\"$client_ip\"\n";
- print $opts_file_FH "HOSTNAME=\"$hostname\"\n";
- print $opts_file_FH "FQDN=\"$dnsname\"\n";
- close($opts_file_FH);
last;
} else {
$try_to_register++;
index a230a309e4205a1dceae887f78898d28f99d268a..b4b37bb9ba81e5de69723d93dd58a87153a46bc6 100644 (file)
# if delivery not possible raise error and return
if( not @out_msg_l ) {
- &main::daemon_log("WARNING: GosaPackages got not answer from event handler '$header'", 3);
+ &main::daemon_log("WARNING: GosaPackages got no answer from event handler '$header'", 3);
} elsif( 0 == @out_msg_l) {
&main::daemon_log("ERROR: GosaPackages: no event handler or core function defined for '$header'", 1);
}
index 1859b3003d6ad5883a86d8de5bc83c66d6b6b1fe..c176086778b1cade2a78d596907038b3d6e5dff8 100644 (file)
# if delivery not possible raise error and return
if( not @out_msg_l ) {
- &main::daemon_log("WARNING: SIPackages got not answer from event handler '$header'", 3);
+ &main::daemon_log("WARNING: SIPackages got no answer from event handler '$header'", 3);
} elsif( 0 == @out_msg_l) {
&main::daemon_log("ERROR: SIPackages: no event handler or core function defined for '$header'", 1);
}
# return acknowledgement to client
$out_hash = &create_xml_hash("registered", $server_address, $source);
- my $register_out = &create_xml_string($out_hash);
- push(@out_msg_l, $register_out);
# notify registered client to bus
if( $bus_activ eq "on") {
}
# give the new client his ldap config
+ # Workaround: Send within the registration response, if the client will get an ldap config later
my $new_ldap_config_out = &new_ldap_config($source);
if( $new_ldap_config_out ) {
- push(@out_msg_l, $new_ldap_config_out);
+ &add_content2xml_hash($out_hash, "ldap_available", "true");
+ }
+ my $register_out = &create_xml_string($out_hash);
+ push(@out_msg_l, $register_out);
+
+ # Really send the ldap config
+ if( $new_ldap_config_out ) {
+ push(@out_msg_l, $new_ldap_config_out);
}
my $hardware_config_out = &hardware_config($source, $gotoHardwareChecksum);
$mesg = $main::ldap_handle->search( base => $ldap_base,
scope => 'sub',
attrs => ['dn', 'gotoLdapServer', 'gosaUnitTag', 'FAIclass'],
- filter => "(&(objectClass=GOhard)(macaddress=$macaddress)(gotoMode=active))");
+ filter => "(&(objectClass=GOhard)(macaddress=$macaddress)(gotoLdapServer=*))");
#$mesg->code && die $mesg->error;
if($mesg->code) {
&main::daemon_log($mesg->error, 1);
&main::daemon_log("\tbase: $ldap_base", 1);
&main::daemon_log("\tscope: sub", 1);
&main::daemon_log("\tattrs: dn, gotoLdapServer", 1);
- &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress))", 1);
+ &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress)(gotoLdapServer=*))", 1);
return;
}