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