Setting WebAPP label to pkgId again. This reverts commit 9bbaf8f2f2be6b59b2b6fc0c1624...
authorTomasz Swierczek <t.swierczek@samsung.com>
Wed, 24 Apr 2013 12:22:10 +0000 (14:22 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 25 Apr 2013 07:34:52 +0000 (09:34 +0200)
[Issue#]       SSDWSSP-94
[Feature]      Changed WebApp SMACK label set in AUL
[Cause]        N/A
[Solution]     Hybrid apps need this
[Verification] Build, install, reboot target. Run any widget. It should run properly.

Change-Id: I3efe0731d72941337df579589f922ff382e835bb

src/privilege-control.c

index af417f1..8ff383e 100644 (file)
@@ -513,7 +513,7 @@ static app_type_t verify_app_type(const char* type, const char* path)
        C_LOGE("EXIT_FAILURE");
        exit(EXIT_FAILURE);
 }
-
+/*
 static const char* parse_widget_id(const char* path)
 {
        C_LOGD("Enter function: %s", __func__);
@@ -526,7 +526,7 @@ static const char* parse_widget_id(const char* path)
 
        C_LOGD("return widget id: %s", basename);
        return basename;
-}
+}*/
 #endif // SMACK_ENABLED
 
 API int set_app_privilege(const char* name, const char* type, const char* path)
@@ -539,7 +539,8 @@ API int set_app_privilege(const char* name, const char* type, const char* path)
 
        switch(verify_app_type(type, path)) {
        case APP_TYPE_WGT:
-               widget_id = parse_widget_id(path);
+               //widget_id = parse_widget_id(path);
+               widget_id = name;
                if (widget_id == NULL) {
                        C_LOGE("PC_ERR_INVALID_PARAM");
                        ret = PC_ERR_INVALID_PARAM;
@@ -751,14 +752,14 @@ static int set_smack_for_wrt(const char* widget_id)
        C_LOGD("Enter function: %s", __func__);
        if (!have_smack())
                return PC_OPERATION_SUCCESS;
+/*
        int ret;
-
        ret = app_reset_permissions(widget_id);
        if (ret != PC_OPERATION_SUCCESS) {
                C_LOGE("app_reset_permissions failed");
                return ret;
        }
-
+*/
        if (smack_set_label_for_self(widget_id) != 0) {
                C_LOGE("smack_set_label_for_self failed");
                return PC_ERR_INVALID_OPERATION;
@@ -1333,7 +1334,7 @@ API int app_install(const char* app_id)
        if (ret != PC_OPERATION_SUCCESS)
                return ret;
 
-       fd = open(smack_path, O_RDWR|O_EXCL|O_CREAT, 0644);
+       fd = open(smack_path, O_RDWR|O_CREAT, 0644);
        if (fd == -1) {
                C_LOGE("file open failed: %s", strerror(errno));
                return PC_ERR_FILE_OPERATION;
@@ -1371,7 +1372,8 @@ API int app_uninstall(const char* app_id)
 
        if (unlink(smack_path)) {
                C_LOGE("unlink failed: ", strerror(errno));
-               return PC_ERR_INVALID_OPERATION;
+//             return PC_ERR_INVALID_OPERATION;
+               return PC_OPERATION_SUCCESS;
        }
 
        return PC_OPERATION_SUCCESS;