index 100e0281b1c4ccfd926007c8b3e755999d54c9c3..ad94ee2f0e3d45918a1dd7a4b844efde95bc0adf 100644 (file)
package ClientPackages;
-use Exporter;
-@ISA = ("Exporter");
-
# Each module has to have a function 'process_incoming_msg'. This function works as a interface to gosa-sd and receives the msg hash from gosa-sd. 'process_incoming_function checks, wether it has a function to process the incoming msg and forward the msg to it.
use strict;
use warnings;
-use GOSA::GosaSupportDaemon;
+
use IO::Socket::INET;
use XML::Simple;
use Data::Dumper;
use Net::LDAP::Util;
use Socket;
use Net::hostent;
+use GOsaSI::GosaSupportDaemon;
+
+use Exporter;
+
+our @ISA = ("Exporter");
my $event_dir = "/usr/lib/gosa-si/server/ClientPackages";
use lib "/usr/lib/gosa-si/server/ClientPackages";
my $mesg;
my %cfg_defaults = (
-"server" => {
+"Server" => {
"ip" => [\$server_ip, "0.0.0.0"],
"mac-address" => [\$main::server_mac_address, "00:00:00:00:00"],
"port" => [\$server_port, "20081"],
### START #####################################################################
# read configfile and import variables
+#why not using the main::read_configfile !!
&local_read_configfile();
if ( defined($msg_hash->{'force-hostname'}[0]) &&
length($msg_hash->{'force-hostname'}[0]) > 0){
# $heap->{force-hostname}->{$mac_address}= $msg_hash->{'force-hostname'}[0];
- open (TFILE, ">/var/tmp/$mac_address");
- print TFILE $msg_hash->{'force-hostname'}[0];
- close (TFILE);
+ open (my $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") {
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".
+ &main::daemon_log("$session_id WARNING: client with mac address $mac_address not found/unique/active - not updating ldap entry".
"\n\tbase: $ldap_base".
"\n\tscope: sub".
"\n\tattrs: ipHostNumber".
# Sanity check
if ($ldap_res->count != 1) {
- &main::daemon_log("$session_id ERROR: client with mac address $mac_address not found/unique/active - not sending syslog config".
+ &main::daemon_log("$session_id WARNING: client with mac address $mac_address not found/unique/active - not sending syslog config".
"\n\tbase: $ldap_base".
"\n\tscope: sub".
"\n\tattrs: gotoSyslogServer".
my $ldap_res = $ldap_handle->search( base => $ldap_base,
scope => 'sub',
attrs => ['gotoSyslogServer'],
- filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))");
+ filter => "(&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))");
if($ldap_res->code) {
&main::daemon_log("$session_id ERROR: new_syslog_config: ldap search: ".$ldap_res->error, 1);
&main::release_ldap_handle($ldap_handle);
"\n\tbase: $ldap_base".
"\n\tscope: sub".
"\n\tattrs: gotoSyslogServer".
- "\n\tfilter: (&(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
+ "\n\tfilter: (&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
&main::release_ldap_handle($ldap_handle);
return;
}
my $ldap_res = $ldap_handle->search( base => $ldap_base,
scope => 'sub',
attrs => ['gotoNtpServer'],
- filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))");
+ filter => "(&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))");
if($ldap_res->code) {
&main::daemon_log("$session_id ERROR: new_ntp_config: ldap search: ".$ldap_res->error, 1);
&main::release_ldap_handle($ldap_handle);
"\n\tbase: $ldap_base".
"\n\tscope: sub".
"\n\tattrs: gotoNtpServer".
- "\n\tfilter: (&(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
+ "\n\tfilter: (&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
&main::release_ldap_handle($ldap_handle);
return;
}
$mesg = $ldap_handle->search( base => $ldap_base,
scope => 'sub',
attrs => ['dn', 'gotoLdapServer', 'FAIclass'],
- filter => "(&(objectClass=gosaGroupOfNames)(member=$filter_dn))");
+ filter => "(&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))");
if($mesg->code) {
&main::daemon_log("$session_id ERROR: new_ldap_config: unable to search for '(&(objectClass=gosaGroupOfNames)(member=$filter_dn))': ".$mesg->error, 1);
&main::release_ldap_handle($ldap_handle);
# Sanity check
if ($mesg->count != 1) {
- &main::daemon_log("$session_id ERROR: new_ldap_config: client with mac address $macaddress not found/unique/active - not sending ldap config".
+ &main::daemon_log("$session_id WARNING: new_ldap_config: client with mac address $macaddress not found/unique/active - not sending ldap config".
"\n\tbase: $ldap_base".
"\n\tscope: sub".
"\n\tattrs: dn, gotoLdapServer, FAIclass".
- "\n\tfilter: (&(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
+ "\n\tfilter: (&(gosaGroupObjects=[W])(objectClass=gosaGroupOfNames)(member=$filter_dn))", 1);
&main::release_ldap_handle($ldap_handle);
return;
}
} else {
my $entry= $mesg->entry(0);
if (defined($entry->get_value("gotoHardwareChecksum"))) {
- if (! $entry->get_value("gotoHardwareChecksum") eq $gotoHardwareChecksum) {
+ if (! ($entry->get_value("gotoHardwareChecksum") eq $gotoHardwareChecksum)) {
$entry->replace(gotoHardwareChecksum => $gotoHardwareChecksum);
if($entry->update($ldap_handle)) {
&main::daemon_log("$session_id INFO: Hardware changed! Detection triggered.", 5);
} else {
my $PROC_NET_ROUTE= ('/proc/net/route');
- open(PROC_NET_ROUTE, "<$PROC_NET_ROUTE")
+ open(my $FD_PROC_NET_ROUTE, "<", "$PROC_NET_ROUTE")
or die "Could not open $PROC_NET_ROUTE";
- my @ifs = <PROC_NET_ROUTE>;
+ my @ifs = <$FD_PROC_NET_ROUTE>;
- close(PROC_NET_ROUTE);
+ close($FD_PROC_NET_ROUTE);
# Eat header line
shift @ifs;