#include "fota_common.h"
#include "ua.h"
+static int feature_support_capability;
+
/************************************************************
* common functions
************************************************************/
char path[MAX_PATH] = { '\0' };
SS_unicode_to_char((const char *)strPath, (char *)path);
- //LOGL(LOG_REDBEND, "%s\n", path);
+ //LOGL(LOG_SSENGINE, "%s\n", path);
ret = rmdir(path);
if ((ret == 0)
|| ((ret < 0) && ((errno == ENOENT) || (errno == ENOTEMPTY)))) {
* The file attributes token (\a ui8pAttribs) is defined at generation time.
* If attributes are not defined explicitly, they are given the following,
* OS-dependent values:
- * \li Windows: _redbend_ro_ for R/O files, _redbend_rw_ for R/W files
- * \li Linux: _redbend_oooooo:xxxx:yyyy indicating the file mode, uid, and gid
+ * \li Windows: _foo_ro_ for R/O files, _foo_rw_ for R/W files
+ * \li Linux: _foo_oooooo:xxxx:yyyy indicating the file mode, uid, and gid
* (uid and gid use capitalized hex digits as required)
*
* \param pbUserData Optional opaque data-structure to pass to IPL
struct stat sbuf;
int ret = 0;
char *smack_attr_pos = NULL;
-#if defined(FEATURE_SUPPORT_CAPABILITY)
int has_cap = 0;
char cap_raw[100];
int cap_len;
char acl_raw[256];
int acl_len;
-#endif
if (NULL == ui16pFilePath) {
LOGL(LOG_SSENGINE, "ui16pFilePath NULL [error]\n");
return E_SS_BAD_PARAMS;
smack_attr_pos++;
setGroupID = (gid_t) strtol(tp, &endstr, 10);
}
-#if defined(FEATURE_SUPPORT_CAPABILITY)
- // Get Capability
- has_cap = 0;
- if (*smack_attr_pos != '\0') {
- char *cap_mark = "capability=0x";
- int cap_mark_len = strlen(cap_mark);
- psmack = strstr(smack_attr_pos, cap_mark);
- if(psmack) {
- int cap_hex_len;
- int i;
- char ch1, ch2;
- int raw1, raw2;
- tp = strstr(psmack, ":");
- smack_attr_pos = tp + 1;
- memset(tmpSmackAttribs, 0x0, sizeof(tmpSmackAttribs));
- memcpy(tmpSmackAttribs, psmack+cap_mark_len,
- (int)tp - (int)psmack - cap_mark_len);
-
- // convert hexadecimal into raw data
- cap_hex_len = strlen(tmpSmackAttribs);
- cap_len = cap_hex_len/2;
- memset(cap_raw, 0x00, sizeof(cap_raw));
- for (i=0; i<cap_len; i++) {
- ch1 = tmpSmackAttribs[i*2];
- ch2 = tmpSmackAttribs[i*2+1];
- if ((ch1 >= '0')&&(ch1 <= '9')) raw1 = ch1 - '0';
- else if ((ch1 >= 'a')&&(ch1 <= 'f')) raw1 = ch1 - 'a' + 10;
- else if ((ch1 >= 'A')&&(ch1 <= 'F')) raw1 = ch1 - 'A' + 10;
- else raw1 = 0;
- if ((ch2 >= '0')&&(ch2 <= '9')) raw2 = ch2 - '0';
- else if ((ch2 >= 'a')&&(ch2 <= 'f')) raw2 = ch2 - 'a' + 10;
- else if ((ch2 >= 'A')&&(ch2 <= 'F')) raw2 = ch2 - 'A' + 10;
- else raw2 = 0;
-
- cap_raw[i] = raw1*16 + raw2;
+ if (feature_support_capability) {
+ // Get Capability
+ has_cap = 0;
+ if (*smack_attr_pos != '\0') {
+ char *cap_mark = "capability=0x";
+ int cap_mark_len = strlen(cap_mark);
+ psmack = strstr(smack_attr_pos, cap_mark);
+ if(psmack) {
+ int cap_hex_len;
+ int i;
+ char ch1, ch2;
+ int raw1, raw2;
+
+ tp = strstr(psmack, ":");
+ smack_attr_pos = tp + 1;
+ memset(tmpSmackAttribs, 0x0, sizeof(tmpSmackAttribs));
+ memcpy(tmpSmackAttribs, psmack+cap_mark_len,
+ (int)tp - (int)psmack - cap_mark_len);
+
+ // convert hexadecimal into raw data
+ cap_hex_len = strlen(tmpSmackAttribs);
+ cap_len = cap_hex_len/2;
+ memset(cap_raw, 0x00, sizeof(cap_raw));
+ for (i=0; i<cap_len; i++) {
+ ch1 = tmpSmackAttribs[i*2];
+ ch2 = tmpSmackAttribs[i*2+1];
+ if ((ch1 >= '0')&&(ch1 <= '9')) raw1 = ch1 - '0';
+ else if ((ch1 >= 'a')&&(ch1 <= 'f')) raw1 = ch1 - 'a' + 10;
+ else if ((ch1 >= 'A')&&(ch1 <= 'F')) raw1 = ch1 - 'A' + 10;
+ else raw1 = 0;
+ if ((ch2 >= '0')&&(ch2 <= '9')) raw2 = ch2 - '0';
+ else if ((ch2 >= 'a')&&(ch2 <= 'f')) raw2 = ch2 - 'a' + 10;
+ else if ((ch2 >= 'A')&&(ch2 <= 'F')) raw2 = ch2 - 'A' + 10;
+ else raw2 = 0;
+
+ cap_raw[i] = raw1*16 + raw2;
+ }
+ LOGL(LOG_SSENGINE, "[Cap] %s (cap_len=%d)\n", tmpSmackAttribs, cap_len);
+ has_cap = 1;
}
- LOGL(LOG_SSENGINE, "[Cap] %s (cap_len=%d)\n", tmpSmackAttribs, cap_len);
- has_cap = 1;
- }
- }
- // Get ACL
- has_acl = 0;
- if (*smack_attr_pos != '\0') {
- char *acl_mark = "acl_access=0x";
- int acl_mark_len = strlen(acl_mark);
- psmack = strstr(smack_attr_pos, acl_mark);
- if(psmack) {
- int acl_hex_len;
- int i;
- char ch1, ch2;
- int raw1, raw2;
-
- tp = strstr(psmack, ":");
- smack_attr_pos = tp + 1;
- memset(tmpSmackAttribs, 0x0, sizeof(tmpSmackAttribs));
- memcpy(tmpSmackAttribs, psmack+acl_mark_len,
- (int)tp - (int)psmack - acl_mark_len);
-
- // convert hexadecimal into raw data
- acl_hex_len = strlen(tmpSmackAttribs);
- acl_len = acl_hex_len/2;
- memset(acl_raw, 0x00, sizeof(acl_raw));
- for (i=0; i<acl_len; i++) {
- ch1 = tmpSmackAttribs[i*2];
- ch2 = tmpSmackAttribs[i*2+1];
- if ((ch1 >= '0')&&(ch1 <= '9')) raw1 = ch1 - '0';
- else if ((ch1 >= 'a')&&(ch1 <= 'f')) raw1 = ch1 - 'a' + 10;
- else if ((ch1 >= 'A')&&(ch1 <= 'F')) raw1 = ch1 - 'A' + 10;
- else raw1 = 0;
- if ((ch2 >= '0')&&(ch2 <= '9')) raw2 = ch2 - '0';
- else if ((ch2 >= 'a')&&(ch2 <= 'f')) raw2 = ch2 - 'a' + 10;
- else if ((ch2 >= 'A')&&(ch2 <= 'F')) raw2 = ch2 - 'A' + 10;
- else raw2 = 0;
-
- acl_raw[i] = raw1*16 + raw2;
- }
- LOG("[ACL] %s (acl_len=%d)\n", tmpSmackAttribs, acl_len);
- has_acl = 1;
}
+ // Get ACL
+ has_acl = 0;
+ if (*smack_attr_pos != '\0') {
+ char *acl_mark = "acl_access=0x";
+ int acl_mark_len = strlen(acl_mark);
+ psmack = strstr(smack_attr_pos, acl_mark);
+ if(psmack) {
+ int acl_hex_len;
+ int i;
+ char ch1, ch2;
+ int raw1, raw2;
+
+ tp = strstr(psmack, ":");
+ smack_attr_pos = tp + 1;
+ memset(tmpSmackAttribs, 0x0, sizeof(tmpSmackAttribs));
+ memcpy(tmpSmackAttribs, psmack+acl_mark_len,
+ (int)tp - (int)psmack - acl_mark_len);
+
+ // convert hexadecimal into raw data
+ acl_hex_len = strlen(tmpSmackAttribs);
+ acl_len = acl_hex_len/2;
+ memset(acl_raw, 0x00, sizeof(acl_raw));
+ for (i=0; i<acl_len; i++) {
+ ch1 = tmpSmackAttribs[i*2];
+ ch2 = tmpSmackAttribs[i*2+1];
+ if ((ch1 >= '0')&&(ch1 <= '9')) raw1 = ch1 - '0';
+ else if ((ch1 >= 'a')&&(ch1 <= 'f')) raw1 = ch1 - 'a' + 10;
+ else if ((ch1 >= 'A')&&(ch1 <= 'F')) raw1 = ch1 - 'A' + 10;
+ else raw1 = 0;
+ if ((ch2 >= '0')&&(ch2 <= '9')) raw2 = ch2 - '0';
+ else if ((ch2 >= 'a')&&(ch2 <= 'f')) raw2 = ch2 - 'a' + 10;
+ else if ((ch2 >= 'A')&&(ch2 <= 'F')) raw2 = ch2 - 'A' + 10;
+ else raw2 = 0;
+
+ acl_raw[i] = raw1*16 + raw2;
+ }
+ LOG("[ACL] %s (acl_len=%d)\n", tmpSmackAttribs, acl_len);
+ has_acl = 1;
+ }
+ }
}
-#endif
// Get Smack value -> Set Smack value
if (*smack_attr_pos != '\0') {
smack_lsetlabel(setFilePath, NULL, SMACK_LABEL_ACCESS);
LOGL(LOG_SSENGINE, "%s chmod error\n", __func__);
return E_SS_FAILURE;
}
-#if defined(FEATURE_SUPPORT_CAPABILITY)
- if (has_cap) {
- if (setxattr(setFilePath, "security.capability", (void*)cap_raw, cap_len, 0) < 0) {
- LOGL(LOG_SSENGINE, "cap setxattr() failed: %s\n", strerror(errno));
+
+ if (feature_support_capability) {
+ if (has_cap) {
+ if (setxattr(setFilePath, "security.capability", (void*)cap_raw, cap_len, 0) < 0) {
+ LOGL(LOG_SSENGINE, "cap setxattr() failed: %s\n", strerror(errno));
+ }
}
- }
- if (has_acl) {
- if (setxattr(setFilePath, "system.posix_acl_access", (void*)acl_raw, acl_len, 0) < 0) {
- LOGL(LOG_SSENGINE, "Acl setxattr() failed: %s\n", strerror(errno));
+ if (has_acl) {
+ if (setxattr(setFilePath, "system.posix_acl_access", (void*)acl_raw, acl_len, 0) < 0) {
+ LOGL(LOG_SSENGINE, "Acl setxattr() failed: %s\n", strerror(errno));
+ }
+ //LOG("Acl setxattr() :")asfd
}
- //LOG("Acl setxattr() :")asfd
}
-#endif
//LOGL(LOG_SSENGINE, "%s SUCCESS\n", __func__);
if (child_pid == 0)
{
#ifdef _NOEXEC_
- #ifdef _TIZEN_REDBEND//bota
+ #ifdef _TIZEN_SSENGINE//bota
SS_HandleProcessRequest(pbUserData, argc, argv);
#endif
LOGL(LOG_SSENGINE, "SS_RunProcess was called - SS_HandleProcessRequest\n");
}
}
+int SS_get_feature_support_capability(void)
+{
+ return feature_support_capability;
+}
-
+void SS_set_feature_support_capability(int val)
+{
+ feature_support_capability = val;
+}