summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorho.namkoong <ho.namkoong@samsung.com>2013-04-17 21:15:58 +0900
committerho.namkoong <ho.namkoong@samsung.com>2013-04-19 22:34:43 +0900
commit6be81aab551d3fc93a334faaff387886d735668b (patch)
treed8e8ed64a9dc00f7551a56393b981a755084fb5e
parent73fef844148ce67c63f7b61d04c16be0f8fef813 (diff)
downloadsdbd-6be81aab551d3fc93a334faaff387886d735668b.tar.gz
sdbd-6be81aab551d3fc93a334faaff387886d735668b.tar.bz2
sdbd-6be81aab551d3fc93a334faaff387886d735668b.zip
[Type] [Module] [Priority] [Jira#] [Redmine#] 8427 [Problem] [Cause] [Solution] [TestCase]
-rw-r--r--packaging/sdbd.spec4
-rw-r--r--src/sdktools.c26
-rw-r--r--src/sdktools.h3
3 files changed, 19 insertions, 14 deletions
diff --git a/packaging/sdbd.spec b/packaging/sdbd.spec
index 2c65498..94ee1bc 100644
--- a/packaging/sdbd.spec
+++ b/packaging/sdbd.spec
@@ -1,6 +1,6 @@
Name: sdbd
Summary: SDB daemon
-Version: 2.1.1
+Version: 2.1.2
Release: 0
Group: TO_BE/FILLED_IN
License: TO BE FILLED IN
@@ -32,6 +32,8 @@ rm -rf %{buildroot}
%endif
%changelog
+* Wed Apr 04 2013 Ho Namkoong <ho.namkoong@samsung.com>
+ - supports platform gdbserver
* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
- supports cs report service using inotify
* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
diff --git a/src/sdktools.c b/src/sdktools.c
index b04c1fd..b5f71b8 100644
--- a/src/sdktools.c
+++ b/src/sdktools.c
@@ -139,10 +139,12 @@ int verify_root_commands(const char *arg1) {
}
int verify_app_path(const char* path) {
+
char buf[PATH_MAX];
+ snprintf(buf, sizeof buf, "^((%s)|(%s))/[a-zA-Z0-9]{%d}/bin/[a-zA-Z0-9_\\-]{1,}(\\.exe)?$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2, 10);
+ int reg_cmp = regcmp(buf, path);
- snprintf(buf, sizeof buf, "^((%s)|(%s))/[a-zA-Z0-9]{%d}/bin/[a-zA-Z0-9_\\-]{1,}(\\.exe)?$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2, APPID_MAX_LENGTH);
- return regcmp(buf, path);
+ return reg_cmp;
}
int regcmp(const char* pattern, const char* str) {
@@ -216,7 +218,7 @@ int exec_app_standalone(const char* path) {
// TODO: check evn setting
}
// TODO: i length check
- if (!strcmp(tokens[i], GDBSERVER_PATH)) { //gdbserver :11 --attach 2332 (cnt=4,)
+ if (!strcmp(tokens[i], GDBSERVER_PATH) || !strcmp(tokens[i], GDBSERVER_PLATFORM_PATH)) { //gdbserver :11 --attach 2332 (cnt=4,)
char *gdb_attach_arg_pattern = "^:[1-9][0-9]{2,5} \\-\\-attach [1-9][0-9]{2,5}$";
int argcnt = cnt-i-1;
if (argcnt == 3 && !strcmp("--attach", tokens[i+2])) {
@@ -241,10 +243,12 @@ int exec_app_standalone(const char* path) {
}
}
}
- if (argcnt >= 2 && verify_app_path(tokens[i+2])) {
- D("parsing.... debug run as mode\n");
- if (set_smack_rules_for_gdbserver(tokens[i+2], 0)) {
- ret = 1;
+ else if (argcnt >= 2) {
+ if(should_drop_privileges() == 0 || verify_app_path(tokens[i+2])) {
+ D("parsing.... debug run as mode\n");
+ if (set_smack_rules_for_gdbserver(tokens[i+2], 0)) {
+ ret = 1;
+ }
}
}
D("finished debug launch mode\n");
@@ -284,19 +288,17 @@ char* clone_gdbserver_label_from_app(const char* app_path) {
char appid[APPID_MAX_LENGTH+1];
char *buffer = NULL;
+#if 0
if (!verify_app_path(app_path)) {
D("not be able to access %s\n", app_path);
return NULL;
}
+#endif
int rc = smack_lgetlabel(app_path, &buffer, SMACK_LABEL_ACCESS);
if (rc == 0 && buffer != NULL) {
- if (strlen(buffer) == APPID_MAX_LENGTH) {
- strcpy(appid, buffer);
- } else {
- strcpy(appid, "_");
- }
+ strcpy(appid, buffer);
free(buffer);
} else {
strcpy(appid, "_");
diff --git a/src/sdktools.h b/src/sdktools.h
index 34f2ecb..5c58298 100644
--- a/src/sdktools.h
+++ b/src/sdktools.h
@@ -26,10 +26,11 @@ struct arg_permit_rule
#define APP_INSTALL_PATH_PREFIX1 "/opt/apps"
#define APP_INSTALL_PATH_PREFIX2 "/opt/usr/apps"
#define GDBSERVER_PATH "/home/developer/sdk_tools/gdbserver/gdbserver"
+#define GDBSERVER_PLATFORM_PATH "/home/developer/sdk_tools/gdbserver-platform/gdbserver"
#define SMACK_LEBEL_SUBJECT_PATH "/proc/self/attr/current"
#define APP_GROUPS_MAX 100
#define APP_GROUP_LIST "/usr/share/privilege-control/app_group_list"
-#define APPID_MAX_LENGTH 10
+#define APPID_MAX_LENGTH 50
int verify_commands(const char *arg1);
int verify_root_commands(const char *arg1);