From 93a9f7d261ebd9614ca9d7feb1504953af999767 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 15 Jul 2008 15:12:21 +0000 Subject: [PATCH] Applied workaround for Sun-LDAP not returning objectclass names as defined. Use the original naming in gosa-si. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11667 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/ArpHandler.pm | 2 +- gosa-si/modules/ClientPackages.pm | 15 +++++++++++---- gosa-si/server/events/siTriggered.pm | 11 ++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gosa-si/modules/ArpHandler.pm b/gosa-si/modules/ArpHandler.pm index 8d9f6f556..f8ab36107 100644 --- a/gosa-si/modules/ArpHandler.pm +++ b/gosa-si/modules/ArpHandler.pm @@ -346,7 +346,7 @@ sub add_ldap_entry { # create LDAP entry my $entry = Net::LDAP::Entry->new( $dn ); $entry->dn($dn); - $entry->add("objectClass" => "goHard"); + $entry->add("objectClass" => "GOhard"); $entry->add("cn" => $hosts_database->{$mac}->{cn}); $entry->add("macAddress" => $mac); if(defined $gotoSysStatus) {$entry->add("gotoSysStatus" => $gotoSysStatus)} diff --git a/gosa-si/modules/ClientPackages.pm b/gosa-si/modules/ClientPackages.pm index 8d4b7e805..dfd104a05 100644 --- a/gosa-si/modules/ClientPackages.pm +++ b/gosa-si/modules/ClientPackages.pm @@ -421,12 +421,19 @@ sub here_i_am { 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){ + #FIXME: move to some global POE namespace - please + 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 { + open (TFILE, ">/var/tmp/$mac_address"); + print TFILE $msg_hash->{'force-hostname'}[0]; + close (TFILE); + } else { # $heap->{force-hostname}->{$mac_address}= undef; - #} + if ( -e "/var/tmp/$mac_address") { + unlink("/var/tmp/$mac_address") + }; + } # number of known clients my $nu_clients= $main::known_clients_db->count_dbentries('known_clients'); diff --git a/gosa-si/server/events/siTriggered.pm b/gosa-si/server/events/siTriggered.pm index e1635269a..ef0eb4398 100644 --- a/gosa-si/server/events/siTriggered.pm +++ b/gosa-si/server/events/siTriggered.pm @@ -164,19 +164,24 @@ sub detected_hardware { &main::daemon_log("INFO: Need to create a new LDAP Entry for client $address", 4); my $ipaddress= $1 if $address =~ /^([0-9\.]*?):.*$/; my $dnsname; + #FIXME: like in ClientPackages! #if ( defined($heap->{force-hostname}->{$macaddress}) ){ # $dnsname= $heap->{force-hostname}->{$macaddress}; # &main::daemon_log("INFO: Using forced hostname $dnsname for client $address", 4); - #} else { + if (-e "/var/tmp/$macaddress" ){ + open(TFILE, "< /var/tmp/$macaddress"); + $dnsname= ; + close(TFILE); + } else { $dnsname= gethostbyaddr(inet_aton($ipaddress), AF_INET) || $ipaddress; - #} + } my $cn = (($dnsname =~ /^(\d){1,3}\.(\d){1,3}\.(\d){1,3}\.(\d){1,3}/) ? $dnsname : sprintf "%s", $dnsname =~ /([^\.]+)\.?/); my $dn = "cn=$cn,ou=incoming,$ldap_base"; &main::daemon_log("INFO: Creating entry for $dn",5); my $entry= Net::LDAP::Entry->new( $dn ); $entry->dn($dn); - $entry->add("objectClass" => "goHard"); + $entry->add("objectClass" => "GOhard"); $entry->add("cn" => $cn); $entry->add("macAddress" => $macaddress); $entry->add("gotomode" => "locked"); -- 2.30.2