Make SS_FSUpdate feature valid 02/140102/5 accepted/tizen/4.0/unified/20170904.143551 accepted/tizen/unified/20170824.050912 submit/tizen/20170823.081423 submit/tizen_4.0/20170830.025641 submit/tizen_4.0/20170830.234433 submit/tizen_4.0/20170901.015617
authorSunmin Lee <sunm.lee@samsung.com>
Mon, 24 Jul 2017 01:44:18 +0000 (10:44 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Mon, 24 Jul 2017 09:51:38 +0000 (18:51 +0900)
After get the SS_FSUpdate from tota-ua,
the feature which is determined in build time doesn't work any longer.
To make it valid, use flag variable instead of preprocessor defined value.

Change-Id: I7d2531dde17798f1b0c21612c83600f5f409f22f
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
ss_engine/SS_Common.c
ss_engine/SS_FSUpdate.c
ss_engine/SS_FSUpdate.h
ss_engine/SS_MultiProcessUpdate.h

index 876fb21..adbc49b 100755 (executable)
@@ -45,7 +45,7 @@ void SS_Progress(void *pbUserData, SS_UINT32 uPercent)
 SS_UINT32 SS_Trace(void *pUser, const char *aFormat, ...)
 {
 #if 0
-    LOGL(LOG_REDBEND, aFormat);
+    LOGL(LOG_SSENGINE, aFormat);
 #else
     char temp[4096];
     va_list list;
index cb03e4c..7dd75db 100755 (executable)
@@ -37,6 +37,8 @@
 #include "fota_common.h"
 #include "ua.h"
 
+static int feature_support_capability;
+
 /************************************************************
  *                     common functions
  ************************************************************/
@@ -208,7 +210,7 @@ long SS_DeleteFolderEmpty(void *pbUserData, const char *strPath)
        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)))) {
@@ -761,8 +763,8 @@ void SS_chtoa(int value, char *str)
  * 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
@@ -793,7 +795,6 @@ long SS_SetFileAttributes(const char *ui16pFilePath,
        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;
@@ -802,7 +803,6 @@ long SS_SetFileAttributes(const char *ui16pFilePath,
        char acl_raw[256];
        int acl_len;
 
-#endif
        if (NULL == ui16pFilePath) {
                LOGL(LOG_SSENGINE, "ui16pFilePath NULL [error]\n");
                return E_SS_BAD_PARAMS;
@@ -865,91 +865,92 @@ long SS_SetFileAttributes(const char *ui16pFilePath,
                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);
@@ -1045,20 +1046,21 @@ long SS_SetFileAttributes(const char *ui16pFilePath,
                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__);
 
@@ -1205,7 +1207,7 @@ void* SS_RunProcess(void *pbUserData, int argc, char* argv[])
        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");
@@ -1240,5 +1242,12 @@ void* SS_RunProcess(void *pbUserData, int argc, char* argv[])
        }
 }
 
+int SS_get_feature_support_capability(void)
+{
+       return feature_support_capability;
+}
 
-
+void SS_set_feature_support_capability(int val)
+{
+       feature_support_capability = val;
+}
index b221582..3bc4e88 100755 (executable)
@@ -306,8 +306,8 @@ extern "C" {
  * 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
@@ -363,6 +363,24 @@ extern "C" {
  */
     void SS_Free(void *pMemBlock);
 
+/**
+ *******************************************************************************
+ * Get capability feature flag value
+ *
+ * \return     The value of feature_support_capability
+ *******************************************************************************
+ */
+    int SS_get_feature_support_capability(void);
+
+/**
+ *******************************************************************************
+ * Set capability feature flag
+ *
+ * \param      val     The value to set feature_support_capability
+ *******************************************************************************
+ */
+    void SS_set_feature_support_capability(int val);
+
 #ifdef __cplusplus
 }
 #endif                          /* __cplusplus */
index 7b85830..73a0d75 100755 (executable)
@@ -66,8 +66,8 @@
  *             You must implement this functionality.
  *******************************************************************************
  */
-#ifndef _REDBEND_MULTIPROCESS_UPDATE_H_
-#define _REDBEND_MULTIPROCESS_UPDATE_H_
+#ifndef _SSENGINE_MULTIPROCESS_UPDATE_H_
+#define _SSENGINE_MULTIPROCESS_UPDATE_H_
 
 #include "SS_Engine_Update.h"
 #include "SS_Engine_Errors.h"