From eaa3230023d1e9d7a6d2bf8f952972ec936c1909 Mon Sep 17 00:00:00 2001 From: "yoonki.park" Date: Tue, 14 May 2013 18:58:44 +0900 Subject: [PATCH] set smack rule for valgrand Change-Id: Idb2cde606504ae106e292788bcb377ba1338c629 Signed-off-by: yoonki.park --- packaging/sdbd.spec | 2 +- src/sdktools.c | 51 ++++++++++++++++++++++----------------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/packaging/sdbd.spec b/packaging/sdbd.spec index 454c935..cff780b 100644 --- a/packaging/sdbd.spec +++ b/packaging/sdbd.spec @@ -1,7 +1,7 @@ Name: sdbd Summary: SDB daemon Version: 2.1.2 -Release: 3 +Release: 4 Group: TO_BE/FILLED_IN License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz diff --git a/src/sdktools.c b/src/sdktools.c index 4c0f457..837af3b 100644 --- a/src/sdktools.c +++ b/src/sdktools.c @@ -20,14 +20,9 @@ struct sudo_command root_commands[] = { /* 0 */ {"killall", "/usr/bin/killall"}, - /* 1 */ //{"pkgcmd", "/usr/bin/pkgcmd"}, - /* 2 */ //{"launch_app", "/usr/bin/launch_app"}, - /* 3 */ //{"dlogutil", "/usr/bin/dlogutil"}, - /* 4 */ {"zypper", "/usr/bin/zypper"}, - /* 5 */ //{"pkginfo", "/usr/bin/pkginfo"}, - /* 6 */ {"da_command", "/usr/bin/da_command"}, - /* 7 */ {"oprofile", "/usr/bin/oprofile_command"}, - /* 8 */ //{"wrt-launcher", "/usr/bin/wrt-launcher"}, + /* 1 */ {"zypper", "/usr/bin/zypper"}, + /* 2 */ {"da_command", "/usr/bin/da_command"}, + /* 3 */ {"oprofile", "/usr/bin/oprofile_command"}, /* end */ {NULL, NULL} }; @@ -101,26 +96,24 @@ int verify_root_commands(const char *arg1) { break; } case 3: { - ret = 1; - break; - } - case 4: { - ret = 1; - break; - } - case 5: { - ret = 1; - break; - } - case 6: { - ret = 1; - break; - } - case 7: { - ret = 1; - break; - } - case 8: { + if (cnt == 3) { + if (!strcmp(tokens[1], "valgrind")) { + char *appid = NULL; + int rc = smack_lgetlabel(tokens[2], &appid, SMACK_LABEL_ACCESS); + if (rc == 0 && appid != NULL) { + if (apply_sdb_rules(SDBD_LABEL_NAME, appid, "rwax") < 0) { + D("unable to set %s %s rules\n", SDBD_LABEL_NAME, appid); + } + if (apply_sdb_rules(appid, SDBD_LABEL_NAME, "rwax") < 0) { + D("unable to set %s %s rules\n", appid, SDBD_LABEL_NAME); + } + //apply_app_process(); + free(appid); + } + D("standalone launch for valgrind\n"); + } + } + ret = 1; break; } @@ -258,7 +251,7 @@ int exec_app_standalone(const char* path) { char *appid = NULL; int rc = smack_lgetlabel(path, &appid, SMACK_LABEL_ACCESS); if (rc == 0 && appid != NULL) { - if (apply_sdb_rules(SDBD_LABEL_NAME, appid, "rx") < 0) { + if (apply_sdb_rules(SDBD_LABEL_NAME, appid, "rxax") < 0) { D("unable to set sdbd rules to %s\n", appid); } if (smack_set_label_for_self(appid) != -1) { -- 2.7.4