summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5485fd7)
raw | patch | inline | side by side (parent: 5485fd7)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Feb 2008 11:37:42 +0000 (11:37 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Feb 2008 11:37:42 +0000 (11:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8718 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/SIPackages.pm | patch | blob | history |
index bcd376f81bc9ba61f109e2923207b9e7b3806a71..f346ae26d566b13b025f7dcb572d6c2d7cb9e0ad 100644 (file)
# Bind to a directory with dn and password
- my $mesg= $ldap->bind($ldap_admin_dn, $ldap_admin_password);
+ my $mesg= $ldap->bind($ldap_admin_dn, password => $ldap_admin_password);
# Perform search
$mesg = $ldap->search( base => $ldap_base,
# DESCRIPTION:
#===============================================================================
sub hardware_config {
- my ($address, $gotoHardwareChecksum, $detectedHardware) = @_ ;
+ my ($address, $gotoHardwareChecksum) = @_ ;
my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$address'";
my $res = $main::known_clients_db->select_dbentry( $sql_statement );
return;
}
-
# Bind to a directory with dn and password
- my $mesg= $ldap->bind($ldap_admin_dn, $ldap_admin_password);
+ my $mesg= $ldap->bind($ldap_admin_dn, password => $ldap_admin_password);
# Perform search
- $mesg = $ldap->search( base => $ldap_base,
- scope => 'sub',
- attrs => ['dn', 'gotoHardwareChecksum'],
- filter => "(&(objectClass=GOhard)(macaddress=$macaddress))");
- #$mesg->code && die $mesg->error;
+ $mesg = $ldap->search(
+ base => $ldap_base,
+ scope => 'sub',
+ filter => "(&(objectClass=GOhard)(|(macAddress=$macaddress)(dhcpHWaddress=ethernet $macaddress)))"
+ );
+
+ if($mesg->count() == 0) {
+ &main::daemon_log("Host was not found in LDAP!", 1);
+ return;
+ }
- #my $entry= $mesg->entry(0);
- #my $dn= $entry->dn;
- #my @servers= $entry->get_value("gotoHardwareChecksum");
+ my $entry= $mesg->entry(0);
+ my $dn= $entry->dn;
+ if(defined($entry->get_value("gotoHardwareChecksum"))) {
+ return;
+ } else {
+ # need to fill it to LDAP
+ $entry->add(gotoHardwareChecksum => $gotoHardwareChecksum);
+ &main::daemon_log(Dumper($entry->update($ldap)),1);
+
+ # 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))"
+ );
+ }
# Assemble data package
my %data = ();