From: Hyunjin Park Date: Wed, 22 Jun 2016 07:21:32 +0000 (+0900) Subject: [filesystem] add code to check group id using setgroups() X-Git-Tag: accepted/tizen/common/20160622.150034~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77d33a3e38fc5ea98ffebfe8b23601c93bff457f;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [filesystem] add code to check group id using setgroups() problem : 216 fail issues on Web TCT cause : permission of content directory is set by setgroups() to priv_mediastorage TCT result : 100% pass rate Change-Id: I0d8fbea0ac90fe9e259f2703ff7f63cebf9f8a3c --- diff --git a/src/filesystem/filesystem_stat.cc b/src/filesystem/filesystem_stat.cc index 41d0693..f90b37d 100755 --- a/src/filesystem/filesystem_stat.cc +++ b/src/filesystem/filesystem_stat.cc @@ -77,6 +77,11 @@ FilesystemStat FilesystemStat::getStat(const std::string& path) { _result.path = path; _result.readOnly = true; + + const int GROUPBUF_SIZE = 100; + gid_t groupbuf[GROUPBUF_SIZE]; + int n_groups = getgroups(GROUPBUF_SIZE, groupbuf); + if (getuid() == aStatObj.st_uid && (aStatObj.st_mode & S_IWUSR) == S_IWUSR) { _result.readOnly = false; } else if (getgid() == aStatObj.st_gid && @@ -84,6 +89,13 @@ FilesystemStat FilesystemStat::getStat(const std::string& path) { _result.readOnly = false; } else if ((aStatObj.st_mode & S_IWOTH) == S_IWOTH) { _result.readOnly = false; + } else if (n_groups > 0) { + for(int i=0; i