Skip to content

Commit

Permalink
Don't allow users to run as root.
Browse files Browse the repository at this point in the history
  • Loading branch information
sandsmark committed Jul 20, 2016
1 parent 2a645cd commit 85d0c5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tools/thermal_monitor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ int main(int argc, char *argv[])

// Warn the user if not running as root
uid_t id = getuid();
if (id != ROOT_ID){
if (id == ROOT_ID){
QMessageBox msgBox;
QString str;

str = QString("%1 requires root privilages to access the thermal daemon. "
"Try invoking again with root privileges.\n")
str = QString("Running X11 applications as root is unsafe.\n"
"Try invoking again without root privileges.\n"
"If you're unable to connect to thermald, ensure that you are in the 'power' group.")
.arg(QCoreApplication::applicationName());
msgBox.setText(str);
msgBox.setStandardButtons(QMessageBox::Abort);
Expand Down
2 changes: 1 addition & 1 deletion tools/thermal_monitor/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
QString str;

str = QString("Can't establish link with thermal daemon."
" Make sure that thermal daemon started with --dbus-enable option.\n");
" Make sure that thermal daemon started with --dbus-enable option and that you're in the 'power' group.\n");
msgBox.setText(str);
msgBox.setStandardButtons(QMessageBox::Abort);
int ret = msgBox.exec();
Expand Down

0 comments on commit 85d0c5e

Please sign in to comment.