summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65e3bd7)
raw | patch | inline | side by side (parent: 65e3bd7)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 24 Jun 2009 15:04:40 +0000 (15:04 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 24 Jun 2009 15:04:40 +0000 (15:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13788 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/ClientPackages.pm | patch | blob | history |
index 1db6d0193cbe264297711c699bf249997db94dea..100e0281b1c4ccfd926007c8b3e755999d54c9c3 100644 (file)
# return acknowledgement to client
$out_hash = &create_xml_hash("registered", $server_address, $source);
-
# 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, $session_id);
push(@out_msg_l, $syslog_config_out);
}
+ # update ldap entry if exists
+ my $ldap_handle= &main::get_ldap_handle();
+ my $ldap_res= $ldap_handle->search(
+ base => $ldap_base,
+ scope => 'sub',
+ #attrs => ['ipHostNumber'],
+ filter => "(&(objectClass=GOhard)(macAddress=$mac_address))");
+ if($ldap_res->code) {
+ &main::daemon_log("$session_id ERROR: LDAP Entry for client with mac address $mac_address not found: ".$ldap_res->error, 1);
+ } elsif ($ldap_res->count != 1) {
+ &main::daemon_log("$session_id ERROR: client with mac address $mac_address not found/unique/active - not updating ldap entry".
+ "\n\tbase: $ldap_base".
+ "\n\tscope: sub".
+ "\n\tattrs: ipHostNumber".
+ "\n\tfilter: (&(objectClass=GOhard)(macaddress=$mac_address))", 1);
+ } else {
+ my $entry= $ldap_res->pop_entry();
+ my $ip_address= $entry->get_value('ipHostNumber');
+ my $source_ip= ($1) if $source =~ /^([0-9\.]*?):[0-9]*$/;
+ if(not defined($ip_address) and defined($source_ip)) {
+ $entry->add( 'ipHostNumber' => $source_ip );
+ my $mesg= $entry->update($ldap_handle);
+ $mesg->code && &main::daemon_log("$session_id ERROR: Updating IP Address for client with mac address $mac_address failed with '".$mesg->mesg()."'", 1);
+ } elsif(defined($source_ip) and not ($source_ip eq $ip_address)) {
+ $entry->replace( 'ipHostNumber' => $source_ip );
+ my $mesg= $entry->update($ldap_handle);
+ $mesg->code && &main::daemon_log("$session_id ERROR: Updating IP Address for client with mac address $mac_address failed with '".$mesg->mesg()."'", 1);
+ } elsif (not defined($source_ip)) {
+ &main::daemon_log("ERROR: Could not parse source value '$source' perhaps not an ip address?", 1);
+ }
+ }
+ &main::release_ldap_handle($ldap_handle);
+
# notify registered client to all other server
my %mydata = ( 'client' => $source, 'macaddress' => $mac_address);
my $mymsg = &build_msg('new_foreign_client', $main::server_address, "KNOWN_SERVER", \%mydata);