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

@@ -95,10 +95,6 @@ void HeadlessManager::start()
QSettings settings;
if(!settings.value("disableUSB", false).toBool()) {
if(!belongsToGroup("vitamtp"))
qCritical() << tr("This user doesn't belong to the vitamtp group, there could be a problem while reading the USB bus.");
usb_thread = new QThread();
client = new CmaClient(m_db);
usb_thread->setObjectName("usb_thread");

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

View File

@@ -51,9 +51,4 @@ bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total);
QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata);
int getVitaProtocolVersion();
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
bool belongsToGroup(const char *groupname);
#endif
#endif // UTILS_H

View File

@@ -98,12 +98,6 @@ void ClientManager::start()
QSettings settings;
if(!settings.value("disableUSB", false).toBool()) {
#ifdef Q_OS_LINUX
if(!belongsToGroup("vitamtp"))
emit messageSent(tr("This user doesn't belong to the vitamtp group, there could be a problem while reading the USB bus."));
#endif
usb_thread = new QThread();
client = new CmaClient(m_db);
usb_thread->setObjectName("usb_thread");

View File

@@ -35,7 +35,7 @@ QTrayIcon::QTrayIcon(QWidget *obj_parent)
: TrayIndicator(obj_parent)
{
#ifdef Q_OS_LINUX
notify_init("qcma");
notify_init("Qcma");
#endif
setAttribute(Qt::WA_TransparentForMouseEvents);
}
@@ -52,7 +52,7 @@ void QTrayIcon::init()
options = new QAction(tr("Settings"), this);
reload = new QAction(tr("Refresh database"), this);
backup = new QAction(tr("Backup Manager"), this);
about = new QAction(tr("About QCMA"), this);
about = new QAction(tr("About Qcma"), this);
about_qt = new QAction(tr("About Qt"), this);
quit = new QAction(tr("Quit"), this);
@@ -75,6 +75,7 @@ void QTrayIcon::init()
tray_icon_menu->addAction(quit);
m_tray_icon = new QSystemTrayIcon(this);
m_tray_icon->setToolTip("Qcma");
m_tray_icon->setContextMenu(tray_icon_menu);
}