index 53ae3d58fc916564ea2bf1fb035105d9ed7f644d..2ae7a78bd3e2d54881f4e9ab86a7c6c51c22c5e5 100644 (file)
my ($cfg_file, %cfg_defaults) = @_;
my $cfg;
my ($cfg_file, %cfg_defaults) = @_;
my $cfg;
- if( defined( $cfg_file) && ( length($cfg_file) > 0 )) {
+ if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) {
if( -r $cfg_file ) {
$cfg = Config::IniFiles->new( -file => $cfg_file );
} else {
if( -r $cfg_file ) {
$cfg = Config::IniFiles->new( -file => $cfg_file );
} else {
# check hit
my $hit_counter = keys %{$res};
if( not $hit_counter == 1 ) {
# check hit
my $hit_counter = keys %{$res};
if( not $hit_counter == 1 ) {
- &main::daemon_log("ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
+ &main::daemon_log("$session_id ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
return;
}
return;
}
my $hostkey = $res->{1}->{hostkey};
if (not defined $macaddress) {
my $hostkey = $res->{1}->{hostkey};
if (not defined $macaddress) {
- &main::daemon_log("ERROR: no mac address found for client $address", 1);
+ &main::daemon_log("$session_id ERROR: no mac address found for client $address", 1);
return;
}
# Build LDAP connection
return;
}
# Build LDAP connection
- &main::refresh_ldap_handle();
- if( not defined $main::ldap_handle ) {
- &main::daemon_log("ERROR: cannot connect to ldap: $ldap_uri", 1);
+ my $ldap_handle = &main::get_ldap_handle($session_id);
+ if( not defined $ldap_handle ) {
+ &main::daemon_log("$session_id ERROR: cannot connect to ldap: $ldap_uri", 1);
return;
}
# Perform search
return;
}
# Perform search
- $mesg = $main::ldap_handle->search(
+ $mesg = $ldap_handle->search(
base => $ldap_base,
scope => 'sub',
filter => "(&(objectClass=GOhard)(|(macAddress=$macaddress)(dhcpHWaddress=ethernet $macaddress)))"
base => $ldap_base,
scope => 'sub',
filter => "(&(objectClass=GOhard)(|(macAddress=$macaddress)(dhcpHWaddress=ethernet $macaddress)))"
$entry->add("objectClass" => "gosaAdministrativeUnitTag");
$entry->add("gosaUnitTag" => $main::gosa_unit_tag);
}
$entry->add("objectClass" => "gosaAdministrativeUnitTag");
$entry->add("gosaUnitTag" => $main::gosa_unit_tag);
}
- my $res=$entry->update($main::ldap_handle);
+ my $res=$entry->update($ldap_handle);
if(defined($res->{'errorMessage'}) &&
length($res->{'errorMessage'}) >0) {
&main::daemon_log("ERROR: can not add entries to LDAP: ".$res->{'errorMessage'}, 1);
return;
} else {
# Fill $mesg again
if(defined($res->{'errorMessage'}) &&
length($res->{'errorMessage'}) >0) {
&main::daemon_log("ERROR: can not add entries to LDAP: ".$res->{'errorMessage'}, 1);
return;
} else {
# Fill $mesg again
- $mesg = $main::ldap_handle->search(
+ $mesg = $ldap_handle->search(
base => $ldap_base,
scope => 'sub',
filter => "(&(objectClass=GOhard)(|(macAddress=$macaddress)(dhcpHWaddress=ethernet $macaddress)))"
base => $ldap_base,
scope => 'sub',
filter => "(&(objectClass=GOhard)(|(macAddress=$macaddress)(dhcpHWaddress=ethernet $macaddress)))"
}
}
}
}
- my $res=$entry->update($main::ldap_handle);
+ my $res=$entry->update($ldap_handle);
if(defined($res->{'errorMessage'}) &&
length($res->{'errorMessage'}) >0) {
&main::daemon_log("ERROR: can not add entries to LDAP: ".$res->{'errorMessage'}, 1);
if(defined($res->{'errorMessage'}) &&
length($res->{'errorMessage'}) >0) {
&main::daemon_log("ERROR: can not add entries to LDAP: ".$res->{'errorMessage'}, 1);