mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-07 19:05:52 +00:00
fix possible segfaults with null arrays (#5)
This commit is contained in:
@ -27,6 +27,7 @@ Ver.1.2.0:
|
|||||||
* [lib] rewrited getSettingsFromProfile() function
|
* [lib] rewrited getSettingsFromProfile() function
|
||||||
* [plasmoid] edited configuration interface
|
* [plasmoid] edited configuration interface
|
||||||
* [plasmoid] changed double click event to click event
|
* [plasmoid] changed double click event to click event
|
||||||
|
- [gui] fix possible segfaults with null arrays (#5)
|
||||||
|
|
||||||
Ver.1.1.0 (netctl-1.7 update):
|
Ver.1.1.0 (netctl-1.7 update):
|
||||||
+ [gui] added frequency
|
+ [gui] added frequency
|
||||||
|
2
PKGBUILD
2
PKGBUILD
@ -15,7 +15,7 @@ optdepends=('kdebase-runtime: sudo support'
|
|||||||
'wpa_supplicant: wifi support')
|
'wpa_supplicant: wifi support')
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||||
install="${pkgbase}.install"
|
install="${pkgbase}.install"
|
||||||
md5sums=('82954cf5531f0c94854b76eb463ed981')
|
md5sums=('e6ad580c9f7fcd593480f14cd93c471c')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
rm -rf "${srcdir}/"{build-plasmoid,build-qt4,build-qt5}
|
rm -rf "${srcdir}/"{build-plasmoid,build-qt4,build-qt5}
|
||||||
|
@ -69,7 +69,9 @@ QString Language::defineLanguageFromFile(const QString configPath)
|
|||||||
return language;
|
return language;
|
||||||
while (true) {
|
while (true) {
|
||||||
fileStr = QString(configFile.readLine());
|
fileStr = QString(configFile.readLine());
|
||||||
|
if (fileStr.isEmpty()) continue;
|
||||||
if (fileStr[0] == QChar('#')) continue;
|
if (fileStr[0] == QChar('#')) continue;
|
||||||
|
if (fileStr[0] == QChar(';')) continue;
|
||||||
if (fileStr.contains(QString("LANGUAGE=")))
|
if (fileStr.contains(QString("LANGUAGE=")))
|
||||||
language = fileStr.split(QChar('='))[1]
|
language = fileStr.split(QChar('='))[1]
|
||||||
.remove(QChar(' '))
|
.remove(QChar(' '))
|
||||||
|
@ -231,7 +231,6 @@ void MainWindow::createActions()
|
|||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
||||||
connect(ui->actionAbout, SIGNAL(triggered(bool)), aboutWin, SLOT(show()));
|
connect(ui->actionAbout, SIGNAL(triggered(bool)), aboutWin, SLOT(show()));
|
||||||
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
||||||
ui->actionNetctlAuto->setVisible(checkExternalApps(QString("all")));
|
|
||||||
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
||||||
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(close()));
|
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(close()));
|
||||||
|
|
||||||
|
@ -358,6 +358,7 @@ QMap<QString, QString> SettingsWindow::getSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
while (true) {
|
while (true) {
|
||||||
fileStr = QString(configFile.readLine()).trimmed();
|
fileStr = QString(configFile.readLine()).trimmed();
|
||||||
|
if (fileStr.isEmpty()) continue;
|
||||||
if (fileStr[0] == QChar('#')) continue;
|
if (fileStr[0] == QChar('#')) continue;
|
||||||
if (fileStr[0] == QChar(';')) continue;
|
if (fileStr[0] == QChar(';')) continue;
|
||||||
if (!fileStr.contains(QChar('='))) continue;
|
if (!fileStr.contains(QChar('='))) continue;
|
||||||
|
@ -126,9 +126,9 @@ QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, cons
|
|||||||
*/
|
*/
|
||||||
QString Netctl::getWifiInterface()
|
QString Netctl::getWifiInterface()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]";
|
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]";
|
||||||
if (ifaceDirectory == 0) {
|
if (ifaceDirectory == 0) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]" << ":" << "Could not find directory";
|
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]" << ":" << "Could not find directory";
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,13 +137,16 @@ QString Netctl::getWifiInterface()
|
|||||||
interfaces.append(mainInterface);
|
interfaces.append(mainInterface);
|
||||||
QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
for (int i=0; i<allInterfaces.count(); i++) {
|
for (int i=0; i<allInterfaces.count(); i++) {
|
||||||
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]" << ":" << "Check directory"
|
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]" << ":" << "Check directory"
|
||||||
<< ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless");
|
<< ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless");
|
||||||
if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] +
|
if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] +
|
||||||
QDir::separator() + QString("wireless")).exists())
|
QDir::separator() + QString("wireless")).exists())
|
||||||
interfaces.append(allInterfaces[i]);
|
interfaces.append(allInterfaces[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interfaces.count() == 0)
|
||||||
|
return QString("");
|
||||||
|
else
|
||||||
return interfaces[0];
|
return interfaces[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +247,8 @@ bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
|
|||||||
QProcess command;
|
QProcess command;
|
||||||
QString commandText;
|
QString commandText;
|
||||||
QString interface = getWifiInterface();
|
QString interface = getWifiInterface();
|
||||||
|
if (interface.isEmpty())
|
||||||
|
return false;
|
||||||
if (sudo)
|
if (sudo)
|
||||||
commandText = sudoCommand + QString(" ") + systemctlCommand + QString(" ") + commandLine +
|
commandText = sudoCommand + QString(" ") + systemctlCommand + QString(" ") + commandLine +
|
||||||
QString(" ") + netctlAutoService + QString("@") + interface + QString(".service");
|
QString(" ") + netctlAutoService + QString("@") + interface + QString(".service");
|
||||||
@ -341,6 +346,7 @@ QString Netctl::getProfileDescription(const QString profile)
|
|||||||
return description;
|
return description;
|
||||||
while (true) {
|
while (true) {
|
||||||
fileStr = QString(profileFile.readLine());
|
fileStr = QString(profileFile.readLine());
|
||||||
|
if (fileStr.isEmpty()) continue;
|
||||||
if (fileStr[0] == QChar('#')) continue;
|
if (fileStr[0] == QChar('#')) continue;
|
||||||
if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2)
|
if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2)
|
||||||
if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("Description"))
|
if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("Description"))
|
||||||
@ -465,6 +471,7 @@ QString Netctl::getSsidFromProfile(const QString profile)
|
|||||||
return ssidName;
|
return ssidName;
|
||||||
while (true) {
|
while (true) {
|
||||||
fileStr = QString(profileFile.readLine());
|
fileStr = QString(profileFile.readLine());
|
||||||
|
if (fileStr.isEmpty()) continue;
|
||||||
if (fileStr[0] == QChar('#')) continue;
|
if (fileStr[0] == QChar('#')) continue;
|
||||||
if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2)
|
if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2)
|
||||||
if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("ESSID"))
|
if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("ESSID"))
|
||||||
|
@ -287,6 +287,10 @@ bool WpaSup::startWpaSupplicant()
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find wpa_supplicant";
|
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find wpa_supplicant";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (getInterfaceList().count() == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find interfaces";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (QFile(pidFile).exists())
|
if (QFile(pidFile).exists())
|
||||||
return true;
|
return true;
|
||||||
@ -339,6 +343,10 @@ QString WpaSup::getWpaCliOutput(const QString commandLine)
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli";
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli";
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
if (getInterfaceList().count() == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find interfaces";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
QProcess command;
|
QProcess command;
|
||||||
QString interface = getInterfaceList()[0];
|
QString interface = getInterfaceList()[0];
|
||||||
@ -371,6 +379,10 @@ bool WpaSup::wpaCliCall(const QString commandLine)
|
|||||||
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find wpa_cli";
|
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find wpa_cli";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (getInterfaceList().count() == 0) {
|
||||||
|
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find interfaces";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
QProcess command;
|
QProcess command;
|
||||||
QString interface = getInterfaceList()[0];
|
QString interface = getInterfaceList()[0];
|
||||||
|
Reference in New Issue
Block a user