Check insert option when iptables commit 32/191332/1
authorhyunuktak <hyunuk.tak@samsung.com>
Tue, 16 Oct 2018 06:02:58 +0000 (15:02 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Tue, 16 Oct 2018 06:03:02 +0000 (15:03 +0900)
Change-Id: Iabf6dfda8008ebe93ce81cf3bab07c2eaef7a99c
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
include/stc-manager.h
src/monitor/stc-monitor-proc.c
src/stc-firewall.c [changed mode: 0755->0644]
src/stc-manager.c [changed mode: 0755->0644]
src/stc-restriction.c [changed mode: 0755->0644]

index 1658bc6..9496953 100644 (file)
@@ -36,6 +36,7 @@
 #define STC_IPTABLES "/usr/sbin/iptables"
 #define STC_IP6TABLES "/usr/sbin/ip6tables"
 
+#define STC_CMD_INSERT "-I"
 #define STC_CMD_SIZE 256
 
 #define STC_DEBUG_LOG (stc_util_get_debuglog())
index 8bd13a7..e3d2457 100755 (executable)
@@ -38,7 +38,6 @@ static void __proc_remove_pid(gpointer key, gpointer value,
 {
        stc_app_value_s *app_value = (stc_app_value_s *)value;
        remove_pid_context_s *context = (remove_pid_context_s *)data;
-       guint pid_count = 0;
 
        if (!g_hash_table_remove(app_value->processes, GUINT_TO_POINTER(context->pid)))
                return;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7b4876a..a61a8ac
@@ -178,6 +178,13 @@ int stc_commit_iptables(char *cmd, int *err_num, char **err_str)
 
        if (pid == 0) {
                errno = 0;
+
+               if (!g_strcmp0(args[1], STC_CMD_INSERT)) {
+                       STC_LOGE("Invalid arguments");
+                       g_strfreev(args);
+                       exit(-1);
+               }
+
                if (execv(args[0], args) == -1) {
                        STC_LOGE("Failed to execute [%s]", *err_str);
                        g_strfreev(args);
old mode 100755 (executable)
new mode 100644 (file)