From 77d33a3e38fc5ea98ffebfe8b23601c93bff457f Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 22 Jun 2016 16:21:32 +0900 Subject: [PATCH] [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 --- src/filesystem/filesystem_stat.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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