diff --git a/doc/wpa-cute.8 b/doc/wpa-cute.8
index e493fa3..42e12cb 100644
--- a/doc/wpa-cute.8
+++ b/doc/wpa-cute.8
@@ -3,7 +3,7 @@
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
-.TH "WPA-CUTE" "8" "12 Juli 2018" "" ""
+.TH "WPA-CUTE" "8" "13 Juli 2018" "" ""
.SH NAME
wpaCute \- A graphical wpa_supplicant front end
@@ -82,7 +82,8 @@ probably changes are on the way, down to 20sec in some static status where
primally is checked if someone is still alive.
.PP
With the main window visible is polled in 5sec.
-Only in (the unthinkable) case of an fatal error is polling halted.
+Only in case of an fatal error is polling halted, which e.g. occurs when the user
+not belongs to the configured 'ctrl_interface_group=foo'.
.SS "EDIT NETWORK"
.PP
The window morphs its look to show always only what is needed, or can be
diff --git a/doc/wpa-cute.html b/doc/wpa-cute.html
index 496c60f..9142efd 100644
--- a/doc/wpa-cute.html
+++ b/doc/wpa-cute.html
@@ -192,7 +192,8 @@ NAME="AEN64"
With the main window visible is polled in 5sec.
- Only in (the unthinkable) case of an fatal error is polling halted.
+ Only in case of an fatal error is polling halted, which e.g. occurs when the user
+ not belongs to the configured 'ctrl_interface_group=foo'.
With the main window visible is polled in 5sec.
- Only in (the unthinkable) case of an fatal error is polling halted.
+ Only in case of an fatal error is polling halted, which e.g. occurs when the user
+ not belongs to the configured 'ctrl_interface_group=foo'.
diff --git a/src/wpagui.cpp b/src/wpagui.cpp
index e3272d1..6865b62 100644
--- a/src/wpagui.cpp
+++ b/src/wpagui.cpp
@@ -307,6 +307,30 @@ int WpaGui::openCtrlConnection(const QString& ifname) {
size_t len(2048); char buf[len];
ctrlInterface = ifname;
+#ifdef CONFIG_NATIVE_WINDOWS
+ static bool first = true;
+ if (first && !serviceRunning()) {
+ first = false;
+ if (QMessageBox::warning(
+ this, ProjAppName,
+ tr("wpa_supplicant service is not "
+ "running.\n"
+ "Do you want to start it?"),
+ QMessageBox::Yes | QMessageBox::No) ==
+ QMessageBox::Yes)
+ startService();
+ }
+#endif /* CONFIG_NATIVE_WINDOWS */
+
+ if (WpaUnknown == wpaState)
+ logHint(tr("Connection to wpa_supplicant..."));
+ else if (WpaNotRunning == wpaState)
+ logHint(tr("Wait for wpa_supplicant..."));
+ else
+ logHint(tr("Changing adapter..."));
+
+ try
+ {
if (ifname.isEmpty()) {
adapterSelect->clear();
@@ -316,9 +340,13 @@ int WpaGui::openCtrlConnection(const QString& ifname) {
ctrlInterface = "udp";
#endif /* CONFIG_CTRL_IFACE_UDP */
#ifdef CONFIG_CTRL_IFACE_UNIX
- if (WpaUnknown == wpaState)
- logHint(tr("Interface not specified"));
QDir dir(ctrlInterfaceDir);
+ if (!dir.exists())
+ throw 1;
+ if (!dir.isReadable())
+ throw 2;
+ if (WpaUnknown == wpaState)
+ logHint(tr("...interface not specified..."));
foreach(QString iface, dir.entryList(QDir::System)) {
ctrlInterface = iface;
if (ctrlInterface.startsWith("p2p-dev-"))
@@ -340,38 +368,17 @@ int WpaGui::openCtrlConnection(const QString& ifname) {
}
}
}
+ if (ctrlInterface.isEmpty())
+ throw 6;
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
}
- try
- {
-
- if (WpaUnknown == wpaState)
- logHint(tr("Connection to wpa_supplicant..."));
- else if (WpaNotRunning == wpaState)
- logHint(tr("Wait for wpa_supplicant..."));
- else
- logHint(tr("Changing adapter..."));
-
- if (ctrlInterface.isEmpty()) {
-#ifdef CONFIG_NATIVE_WINDOWS
- static bool first = true;
- if (first && !serviceRunning()) {
- first = false;
- if (QMessageBox::warning(
- this, ProjAppName,
- tr("wpa_supplicant service is not "
- "running.\n"
- "Do you want to start it?"),
- QMessageBox::Yes | QMessageBox::No) ==
- QMessageBox::Yes)
- startService();
- }
-#endif /* CONFIG_NATIVE_WINDOWS */
- throw 1;
- }
-
#ifdef CONFIG_CTRL_IFACE_UNIX
+ QDir dir(ctrlInterfaceDir);
+ if (!dir.exists())
+ throw 1;
+ if (!dir.isReadable())
+ throw 2;
QString cfile = QString("%1/%2").arg(ctrlInterfaceDir).arg(ctrlInterface);
#else /* CONFIG_CTRL_IFACE_UNIX */
QString cfile = ctrlInterface;
@@ -413,6 +420,7 @@ int WpaGui::openCtrlConnection(const QString& ifname) {
throw 5;
}
}
+
}
catch (int e)
{
@@ -422,10 +430,20 @@ int WpaGui::openCtrlConnection(const QString& ifname) {
switch (e) {
case 1:
- dbgTxt = "Failed to open control connection to wpa_supplicant.";
+ dbgTxt = "ctrlInterfaceDir does not exists";
errTxt = tr("No running wpa_supplicant found");
setState(WpaNotRunning);
break;
+ case 6:
+ dbgTxt = "Some unsuccessful named pipe problem";
+ errTxt = tr("No running wpa_supplicant found");
+ setState(WpaNotRunning);
+ break;
+ case 2:
+ dbgTxt = "ctrlInterfaceDir is not readable";
+ errTxt = tr("You have not the permissions to control wpa_supplicant");
+ setState(WpaFatal);
+ break;
case 3:
dbgTxt = "Failed to open control connection to wpa_supplicant on adapter ";
dbgTxt.append(ctrlInterface);