fix: Removed group checking since the systemd acl can take care of it.

This commit is contained in:
codestation
2016-04-24 18:07:31 -04:30
parent d449a6ae95
commit 88dc196d5c
5 changed files with 3 additions and 64 deletions

View File

@@ -257,50 +257,3 @@ int getVitaProtocolVersion()
return protocol;
}
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
bool belongsToGroup(const char *groupname)
{
int size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
if(size_max == -1)
size_max = 1024;
QByteArray buf(size_max, Qt::Uninitialized);
group *result = NULL;
group entry;
getgrnam_r(groupname, &entry, buf.data(), buf.size(), &result);
if(result != NULL && *result->gr_mem != NULL) {
char **user_list = result->gr_mem;
int user_size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
if(user_size_max == -1)
user_size_max = 1024;
std::vector<char> user_buf(user_size_max);
uid_t user_id = getuid();
while(*user_list != NULL) {
char *user_name = *user_list;
passwd *pw = NULL;
passwd entry;
getpwnam_r(user_name, &entry, user_buf.data(), user_buf.size(), &pw);
if(pw != NULL && pw->pw_uid == user_id) {
return true;
}
user_list++;
}
}
return false;
}
#endif