Code

When matching on macaddresses in SQL, always use the case insensitive variant.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Apr 2009 09:47:38 +0000 (09:47 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Apr 2009 09:47:38 +0000 (09:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13596 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/server/events/gosaTriggered.pm
gosa-si/server/events/siTriggered.pm

index a115ef3246580125bcb32a72ca2f13b4d67f0c17..fbb16fee507b9389f978d0bf958c9f2bf2cba107 100755 (executable)
@@ -1048,7 +1048,7 @@ sub reactivate_job_with_delay {
     if (not defined $delay) { $delay = 30 } ;
     my $delay_timestamp = &calc_timestamp(&get_time(), "plus", $delay);
 
-    my $sql = "UPDATE $job_queue_tn Set timestamp='$delay_timestamp', status='waiting' WHERE (macaddress='$target' AND headertag='$header')"; 
+    my $sql = "UPDATE $job_queue_tn Set timestamp='$delay_timestamp', status='waiting' WHERE (macaddress LIKE 'target' AND headertag='$header')"; 
     my $res = $job_db->update_dbentry($sql);
     daemon_log("$session_id INFO: '$header'-job will be reactivated at '$delay_timestamp' ".
             "cause client '$target' is currently not available", 5);
@@ -1692,7 +1692,7 @@ sub watch_for_opsi_jobs {
             }
             if ($progress ne $result->{'progress'} ) {
                 # Updating progress and result 
-                my $update_statement = "UPDATE $job_queue_tn SET modified='1', progress='".$result->{'progress'}."', result='$act_status' WHERE macaddress='$macaddress' AND siserver='localhost'";
+                my $update_statement = "UPDATE $job_queue_tn SET modified='1', progress='".$result->{'progress'}."', result='$act_status' WHERE macaddress LIKE '$macaddress' AND siserver='localhost'";
                 my $update_res = $job_db->update_dbentry($update_statement);
             }
             if ($progress eq 100) { 
@@ -1703,7 +1703,7 @@ sub watch_for_opsi_jobs {
                 } else {
                     $done_statement .= "status='done'";
                 }
-                $done_statement .= " WHERE macaddress='$macaddress' AND siserver='localhost'";
+                $done_statement .= " WHERE macaddress LIKE '$macaddress' AND siserver='localhost'";
                 my $done_res = $job_db->update_dbentry($done_statement);
             }
 
@@ -3329,13 +3329,11 @@ $ldap_pool = ResourcePool->new($ldap_factory,
         $incoming_db = GOSA::DBsqlite->new($incoming_file_name);
         
         # connect to gosa-si job queue
-        unlink($job_queue_file_name);  ## just for debugging
         $job_db = GOSA::DBsqlite->new($job_queue_file_name);
         chmod(0640, $job_queue_file_name);
         chown($root_uid, $adm_gid, $job_queue_file_name);
         
         # connect to known_clients_db
-        unlink($known_clients_file_name);   ## just for debugging
         $known_clients_db = GOSA::DBsqlite->new($known_clients_file_name);
         chmod(0640, $known_clients_file_name);
         chown($root_uid, $adm_gid, $known_clients_file_name);
index ec585c304daeeef8ab535db61858f751a3f32671..1c3287eb03c4e935acb7bb3549c326a58cc9e017 100644 (file)
@@ -519,7 +519,7 @@ sub trigger_action_faireboot {
     # set job to status 'done', job will be deleted automatically
     my $sql_statement = "UPDATE $main::job_queue_tn ".
         "SET status='done', modified='1'".
-        "WHERE (macaddress='$macaddress' AND status='processing')";
+        "WHERE (macaddress LIKE '$macaddress' AND status='processing')";
     &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
     my $res = $main::job_db->update_dbentry( $sql_statement );
 
@@ -580,7 +580,7 @@ sub trigger_action_localboot {
     # Check for running jobs. In that case return a message to GOsa that running jobs have to be deleted/aborted
     # befor trigger_action_localboot could be effective. Running jobs usually sets FAIstate and GOtomode to
     # what they need again and again and overwrite the 'trigger_action_localboot' setting
-    my $job_sql= "SELECT * FROM $main::job_queue_tn WHERE macaddress='$macaddress'";
+    my $job_sql= "SELECT * FROM $main::job_queue_tn WHERE macaddress LIKE '$macaddress'";
     my $job_res = $main::job_db->select_dbentry($job_sql);
     my $job_res_count = keys(%$job_res);
     if ($job_res_count) {
index d4ec0c668911a0871c2b426a466a6d8c4426af3d..d13ec6fa0fbf9b00c23ab595cbf5b8c81b14f993 100644 (file)
@@ -239,7 +239,7 @@ sub detected_hardware {
        }
 
        # if there is a job in job queue for this host and this macaddress, delete it, cause its no longer used
-       my $del_sql = "DELETE FROM $main::job_queue_tn WHERE (macaddress='$macaddress' AND headertag='$header')";
+       my $del_sql = "DELETE FROM $main::job_queue_tn WHERE (macaddress LIKE '$macaddress' AND headertag='$header')";
        my $del_res = $main::job_db->exec_statement($del_sql);
 
        return ;