Add check if user has permissions to control wpa_supplicant
This fix the not correct hint that the supplicant is not running when the user not belongs to the configured ctrl_interface_group - Treat these as fatal error - Check affect only Unices - Fix (so I think) to start wpa_supplicant on Windows when not running (as always complete untested)
This commit is contained in:
parent
ee97bde0b9
commit
001db2f693
5 changed files with 56 additions and 35 deletions
|
|
@ -3,7 +3,7 @@
|
|||
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
|
||||
.\" Please send any bug reports, improvements, comments, patches,
|
||||
.\" etc. to Steve Cheng <steve@ggi-project.org>.
|
||||
.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
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ NAME="AEN64"
|
|||
</P
|
||||
><P
|
||||
>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'.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
|
|
|
|||
BIN
doc/wpa-cute.pdf
BIN
doc/wpa-cute.pdf
Binary file not shown.
|
|
@ -117,7 +117,8 @@
|
|||
primally is checked if someone is still alive.
|
||||
</para>
|
||||
<para>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'.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue