mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
commit before starting work on helper
This commit is contained in:
parent
c15e387472
commit
1ae30b0821
2
sources/3rdparty/task/taskadds.cpp
vendored
2
sources/3rdparty/task/taskadds.cpp
vendored
@ -22,7 +22,7 @@
|
||||
TaskResult runTask(const QString cmd)
|
||||
{
|
||||
return Task::await<TaskResult>( [ & ]() {
|
||||
QProcess command;
|
||||
SandboxProcess command;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
TaskResult r;
|
||||
|
11
sources/3rdparty/task/taskadds.h
vendored
11
sources/3rdparty/task/taskadds.h
vendored
@ -20,10 +20,21 @@
|
||||
#define TASKADDS_H
|
||||
|
||||
#include <QProcess>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "task.h"
|
||||
|
||||
|
||||
class SandboxProcess : public QProcess
|
||||
{
|
||||
protected:
|
||||
void setupChildProcess()
|
||||
{
|
||||
::setuid(0);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct TaskResult
|
||||
{
|
||||
int exitCode;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
# variables
|
||||
_netctl_gui_arglist=(
|
||||
'--daemonized'
|
||||
'--daemon'
|
||||
'--maximized'
|
||||
'--minimized'
|
||||
'--about'
|
||||
|
@ -60,4 +60,5 @@ endif()
|
||||
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||
# install properties
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QTranslator>
|
||||
#include <iostream>
|
||||
@ -54,6 +55,10 @@ int main(int argc, char *argv[])
|
||||
daemon(0, 0);
|
||||
break;
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
QApplication::setSetuidAllowed(true);
|
||||
qDebug() << QApplication::isSetuidAllowed();
|
||||
#endif
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
// check if exists
|
||||
|
@ -52,6 +52,9 @@
|
||||
#include "vlanwidget.h"
|
||||
#include "wirelesswidget.h"
|
||||
|
||||
#include <polkit-qt5-1/polkitqt1-authority.h>
|
||||
#include <polkit-qt5-1/polkitqt1-subject.h>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent,
|
||||
const QMap<QString, QVariant> args,
|
||||
@ -78,7 +81,6 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
isDaemon = true;
|
||||
else
|
||||
isDaemon = false;
|
||||
createDBusSession();
|
||||
updateConfiguration(args);
|
||||
|
||||
// main actions
|
||||
@ -117,7 +119,6 @@ MainWindow::~MainWindow()
|
||||
{
|
||||
if (debug) qDebug() << "[MainWindow]" << "[~MainWindow]";
|
||||
|
||||
QDBusConnection::sessionBus().unregisterService(QString(DBUS_SERVICE));
|
||||
deleteObjects();
|
||||
}
|
||||
|
||||
@ -294,6 +295,7 @@ void MainWindow::createObjects()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[createObjects]";
|
||||
|
||||
// backend
|
||||
createDBusSession();
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
@ -340,6 +342,7 @@ void MainWindow::deleteObjects()
|
||||
{
|
||||
if (debug) qDebug() << "[MainWindow]" << "[deleteObjects]";
|
||||
|
||||
QDBusConnection::sessionBus().unregisterService(QString(DBUS_SERVICE));
|
||||
if (netctlCommand != nullptr) delete netctlCommand;
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
if (wpaCommand != nullptr) delete wpaCommand;
|
||||
|
@ -19,7 +19,9 @@
|
||||
#define MESSAGES_H
|
||||
|
||||
#include <QChar>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
QString errorMessage();
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
# variables
|
||||
_netctl_gui_arglist=(
|
||||
{'--daemonized','--daemonized'}'[start daemonized]'
|
||||
{'--daemon','--daemon'}'[start as daemon]'
|
||||
{'--maximized','--maximized'}'[start maximized]'
|
||||
{'--minimized','--minimized'}'[start minimized to tray]'
|
||||
{'--about','--about'}'[show about window]'
|
||||
|
@ -97,10 +97,6 @@ bool Netctl::cmdCall(const bool sudo, const QString command, const QString comma
|
||||
if (debug) qDebug() << "[Netctl]" << "[cmdCall]" << ":" << "Could not find command";
|
||||
return false;
|
||||
}
|
||||
if ((sudo) && (sudoCommand == 0)) {
|
||||
if (debug) qDebug() << "[Netctl]" << "[cmdCall]" << ":" << "Could not find sudo";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString cmd = QString("");
|
||||
if (sudo) cmd = sudoCommand + QString(" ");
|
||||
@ -130,10 +126,6 @@ QString Netctl::getCmdOutput(const bool sudo, const QString command, const QStri
|
||||
if (debug) qDebug() << "[Netctl]" << "[getCmdOutput]" << ":" << "Could not find command";
|
||||
return QString();
|
||||
}
|
||||
if ((sudo) && (sudoCommand == 0)) {
|
||||
if (debug) qDebug() << "[Netctl]" << "[getCmdOutput]" << ":" << "Could not find sudo";
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString cmd = QString("");
|
||||
if (sudo) cmd = sudoCommand + QString(" ");
|
||||
|
@ -74,10 +74,6 @@ bool NetctlProfile::copyProfile(const QString oldPath)
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[copyProfile]" << ":" << "Could not find directory";
|
||||
return false;
|
||||
}
|
||||
if (sudoCommand == 0) {
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[copyProfile]" << ":" << "Could not find sudo";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString newPath = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(oldPath).fileName();
|
||||
QString cmd = sudoCommand + QString(" /usr/bin/mv ") + oldPath + QString(" ") + newPath;
|
||||
@ -213,10 +209,6 @@ bool NetctlProfile::removeProfile(const QString profile)
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[removeProfile]" << ":" << "Could not find directory";
|
||||
return false;
|
||||
}
|
||||
if (sudoCommand == 0) {
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[removeProfile]" << ":" << "Could not find sudo";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString profilePath = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(profile).fileName();
|
||||
QString cmd = sudoCommand + QString(" /usr/bin/rm ") + profilePath;
|
||||
|
@ -249,10 +249,6 @@ bool WpaSup::startWpaSupplicant()
|
||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find PID file";
|
||||
return false;
|
||||
}
|
||||
if (sudoCommand == 0) {
|
||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find sudo";
|
||||
return false;
|
||||
}
|
||||
if (wpaDrivers == 0) {
|
||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find drivers";
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user