diff --git a/html/client/get_commands.php b/html/client/get_commands.php
index e8b456a..e809d22 100755
--- a/html/client/get_commands.php
+++ b/html/client/get_commands.php
@@ -62,7 +62,8 @@
else{
$add_after = "";
}
- echo "key_to_check=\"$key_to_check\"\r\ncmd_to_run=\"$cmd $package_string;$add_after\"";
+ echo "key_to_check='$key_to_check'
+cmd_to_run='$cmd $package_string;$add_after'";
}
}
mysql_close($link);
\ No newline at end of file
diff --git a/html/client/run_commands.sh b/html/client/run_commands.sh
index 9c1c29a..3d06d76 100755
--- a/html/client/run_commands.sh
+++ b/html/client/run_commands.sh
@@ -8,13 +8,15 @@ if [[ ! -f "/opt/patch_manager/.patchrc" ]]; then
exit 0
fi
. /opt/patch_manager/.patchrc
+rm -rf /tmp/cmds_$client_key > /dev/null 2>&1
curl -s -H "X-CLIENT-KEY: $client_key" $get_cmd_uri > /tmp/cmds_$client_key
cmds_line_count=$(cat /tmp/cmds_$client_key|wc -l)
if [ "$cmds_line_count" -gt "0" ]; then
. /tmp/cmds_$client_key
- key_to_check=$(head -n 1 /tmp/cmds_$client_key)
- if [ "$key_to_check" = "$auth_key" ]; then
+ key_sum=$(echo $key_to_check|sha256sum)
+ auth_sum=$(echo $auth_key|sha256sum)
+ if [ "$key_sum" == "$auth_sum" ]; then
echo $cmd_to_run|bash
fi
fi
-rm -rf /tmp/cmds_$client_key
+rm -rf /tmp/cmds_$client_key
\ No newline at end of file
diff --git a/html/client/send_patches.php b/html/client/send_patches.php
index 4373e7c..d7a9644 100644
--- a/html/client/send_patches.php
+++ b/html/client/send_patches.php
@@ -9,7 +9,7 @@
$row = mysql_fetch_array($client_check_res);
$server_name = $row['server_name'];
$data = file_get_contents("php://input");
- mysql_query("DELETE FROM `patches` WHERE `server_name='$server_name';");
+ mysql_query("DELETE FROM `patches` WHERE `server_name`='$server_name';");
$package_array = explode("\n", $data);
$suppression_sql = "SELECT * from `supressed` WHERE `server_name` IN('$server_name',0);";
$suppression_res = mysql_query($sql);
diff --git a/html/inc/navbar.inc.php b/html/inc/navbar.inc.php
index 4b11d8d..0fc4680 100644
--- a/html/inc/navbar.inc.php
+++ b/html/inc/navbar.inc.php
@@ -5,7 +5,7 @@
if (!isset($index_check) || $index_check != "active"){
exit();
}
-$patch_list_sql = "SELECT count(*) as total_found FROM `patches` p LEFT JOIN servers s on s.server_name = p.server_name WHERE s.trusted = 1 and p.upgraded=0;";
+$patch_list_sql = "SELECT count(*) as total_found FROM `patches` p LEFT JOIN servers s on s.server_name = p.server_name WHERE s.trusted = 1 and p.upgraded=0; and p.package_name !='';";
$patch_list_link = mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_select_db(DB_NAME,$patch_list_link);
$patch_list_res = mysql_query($patch_list_sql);