From c850938d1b85e6e70df79369fc8532ea8d8c71fa Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 30 Apr 2009 09:47:38 +0000 Subject: [PATCH] When matching on macaddresses in SQL, always use the case insensitive variant. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13596 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 8 +++----- gosa-si/server/events/gosaTriggered.pm | 4 ++-- gosa-si/server/events/siTriggered.pm | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index a115ef324..fbb16fee5 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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); diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index ec585c304..1c3287eb0 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -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) { diff --git a/gosa-si/server/events/siTriggered.pm b/gosa-si/server/events/siTriggered.pm index d4ec0c668..d13ec6fa0 100644 --- a/gosa-si/server/events/siTriggered.pm +++ b/gosa-si/server/events/siTriggered.pm @@ -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 ; -- 2.30.2