summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc815.lee <jc815.lee@samsung.com>2013-05-27 15:15:35 +0900
committerjc815.lee <jc815.lee@samsung.com>2013-05-27 15:18:10 +0900
commit5cdbe4eae9b8ee0ba031895378b4afc8ab4dd4df (patch)
treea927894a7c8398f69ba3494df5299edb64df7915
parent9b4f9b4f659d425cc6884da6ecc16618e96f2fca (diff)
downloadsecure-storage-5cdbe4eae9b8ee0ba031895378b4afc8ab4dd4df.tar.gz
secure-storage-5cdbe4eae9b8ee0ba031895378b4afc8ab4dd4df.tar.bz2
secure-storage-5cdbe4eae9b8ee0ba031895378b4afc8ab4dd4df.zip
fix label length bug when using NULL gtoup id
[model] GT-I8800 [binary_type] Platform [customer] OPEN [issue#] N/A [problem] If process smack label shorter than default, label is going to wrong [cause] didn't clean char array [solution] clean array [team] Framework [request] N/A [horizontal_expansion] Change-Id: I7e698b1ef06edef2f6970f8632f9a6b43d1b046b Signed-off-by: jc815.lee <jc815.lee@samsung.com>
-rwxr-xr-xserver/src/ss_server_main.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/server/src/ss_server_main.c b/server/src/ss_server_main.c
index 69fdc0d..b762e65 100755
--- a/server/src/ss_server_main.c
+++ b/server/src/ss_server_main.c
@@ -225,21 +225,22 @@ int check_privilege_by_sockfd(int sockfd, const char* object, const char* access
{
int ret = -1; // if success, return 0
const char* private_group_id = "NOTUSED";
+ char* default_smack_label = NULL;
+ const char* group_id = object;
if(!IsSmackEnabled())
{
return 0;
}
- if(!strncmp(object,"NOTUSED", strlen(private_group_id)))
+ if(!strncmp(group_id, private_group_id, strlen(private_group_id)))
{
- SLOGD("requested default group_id :%s. get smack label", object);
- char* client_process_smack_label = security_server_get_smacklabel_sockfd(sockfd);
- if(client_process_smack_label)
+ SLOGD("requested default group_id. get smack label");
+ default_smack_label = security_server_get_smacklabel_sockfd(sockfd);
+ if(default_smack_label)
{
- SLOGD("defined smack label : %s", client_process_smack_label);
- strncpy(object, client_process_smack_label, strlen(client_process_smack_label));
- free(client_process_smack_label);
+ SLOGD("defined smack label : %s", default_smack_label);
+ group_id = default_smack_label;
}
else
{
@@ -248,8 +249,13 @@ int check_privilege_by_sockfd(int sockfd, const char* object, const char* access
}
}
- SLOGD("object : %s, access_rights : %s", object, access_rights);
- ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
+ SLOGD("object : %s, access_rights : %s", group_id, access_rights);
+ ret = security_server_check_privilege_by_sockfd(sockfd, group_id, access_rights);
+
+ if(default_smack_label)
+ {
+ free(default_smack_label);
+ }
return ret;
}