Code

Small fixes and checks.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Apr 2008 07:13:25 +0000 (07:13 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Apr 2008 07:13:25 +0000 (07:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10599 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/modules/ArpHandler.pm

index 649ad70c5bd3ea5aa635874389bfdc031a5a1901..0f3b33c9e8a1d184cf111b9d48064b50ef0687e0 100755 (executable)
@@ -1281,7 +1281,11 @@ sub watch_for_new_jobs {
        foreach my $hit (reverse @{$res} ) {
                my $macaddress= lc @{$hit}[8];
                my $headertag= @{$hit}[5];
-               if(defined($hits->{$macaddress}->{$headertag})) {
+               if(
+                       defined($hits->{$macaddress}) &&
+                       defined($hits->{$macaddress}->{$headertag}) &&
+                       defined($hits->{$macaddress}->{$headertag}[0])
+               ) {
                        push @drops, "DELETE FROM $job_queue_tn WHERE id = '$hits->{$macaddress}->{$headertag}[0]'";
                }
                $hits->{$macaddress}->{$headertag}= $hit;
@@ -1291,10 +1295,14 @@ sub watch_for_new_jobs {
        foreach my $macaddress (keys %{$hits}) {
                foreach my $jobdb_headertag (keys %{$hits->{$macaddress}}) {
                        my $jobdb_id = @{$hits->{$macaddress}->{$jobdb_headertag}}[0];
-                       my $sql_statement = "SELECT * FROM $job_queue_tn WHERE macaddress LIKE '$macaddress' AND headertag='$jobdb_headertag' AND status='processing'";
-                       my $res = $job_db->exec_statement( $sql_statement );
-                       foreach my $hit (@{$res}) {
-                               push @drops, "DELETE FROM $job_queue_tn WHERE id = '$jobdb_id'";
+                       if(defined($job_db_id)) {
+                               my $sql_statement = "SELECT * FROM $job_queue_tn WHERE macaddress LIKE '$macaddress' AND headertag='$jobdb_headertag' AND status='processing'";
+                               my $res = $job_db->exec_statement( $sql_statement );
+                               foreach my $hit (@{$res}) {
+                                       push @drops, "DELETE FROM $job_queue_tn WHERE id = '$jobdb_id'";
+                               }
+                       } else {
+                               daemon_log("J ERROR: Job without id exists for macaddress $macaddress!", 1);
                        }
                }
        }
@@ -2014,7 +2022,7 @@ sub create_sources_list {
                        }
                }
        } else {
-        &main::daemon_log("$session_id ERROR: something wrong with ldap_server_dn '$ldap_server_dn', abort create_soureces_list", 1); 
+        &main::daemon_log("$session_id ERROR: something wrong with ldap_server_dn '$ldap_server_dn', abort create_sources_list", 1); 
     }
        close($fh);
 
index 549afed52654af7c984695dd13a3d53f57af569b..1b0997dd2453e6273c89cb38df472860de192891 100644 (file)
@@ -236,7 +236,7 @@ sub get_host_from_ldap {
        my $mac=shift;
        my $result={};
                
-    my $ldap_handle = &get_ldap_handle();     
+    my $ldap_handle = &main::get_ldap_handle();     
        if(defined($ldap_handle)) {
                my $ldap_result= &search_ldap_entry(
                        $ldap_handle,