[PC-BSD Commits] r9859 - pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray

svn at pcbsd.org svn at pcbsd.org
Thu Mar 31 15:18:31 PDT 2011


Author: kris
Date: 2011-03-31 15:18:31 -0700 (Thu, 31 Mar 2011)
New Revision: 9859

Modified:
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h
Log:

Make Network Tray more sudo-safe



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2011-03-31 22:14:18 UTC (rev 9858)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2011-03-31 22:18:31 UTC (rev 9859)
@@ -52,7 +52,7 @@
   DeviceName = Device;
   DeviceType = getTypeForIdent(DeviceName);
 
-  QString cmd = "ifconfig lagg0 2>/dev/null | grep " + DeviceName;
+  QString cmd = IFCONFIG + " lagg0 2>/dev/null | grep " + DeviceName;
   QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
   if ( ! checkLagg.isEmpty() )
     usingLagg = true;
@@ -123,7 +123,7 @@
 
 void NetworkTray::confirmDevice( QString device )
 {
-   QString command = "ifconfig -l | grep " + device;
+   QString command = IFCONFIG + " -l | grep " + device;
    QString line = getLineFromCommandOutput(command);
    if ( line.isEmpty() )
    {
@@ -171,10 +171,10 @@
   else
     tDev = DeviceName;
 
-  QString cmd = "ifconfig " + tDev + " | grep " + DeviceName;
+  QString cmd = IFCONFIG + " " + tDev + " | grep " + DeviceName;
   QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
   if ( ! checkLagg.isEmpty() ) {
-    cmd = "ifconfig " + tDev + " | grep 'inet ' ";
+    cmd = IFCONFIG + " " + tDev + " | grep 'inet ' ";
     inputLine = getLineFromCommandOutput(cmd.toLatin1());
   }
 
@@ -222,7 +222,7 @@
 QString NetworkTray::getSignalStrengthForIdent( QString ident )
 {
   // Get the signal strength of this device
-  QString command = "ifconfig " + ident + " list scan | grep " + DeviceSSID;
+  QString command = IFCONFIG + " " + ident + " list scan | grep " + DeviceSSID;
   QString line = getLineFromCommandOutput(command);
   QString tmp, sig, noise;
   bool ok, ok2;
@@ -272,7 +272,7 @@
 
 QString NetworkTray::getWirelessSpeedForIdent( QString ident )
 {
-  QString command = "ifconfig " + ident + " list scan | grep " + DeviceSSID;
+  QString command = IFCONFIG + " " + ident + " list scan | grep " + DeviceSSID;
   QString line = getLineFromCommandOutput(command);
   QString tmp;
 
@@ -618,13 +618,13 @@
 void NetworkTray::updateIfStatus( QString ident )
 {
    QProcess *getIfProc = new QProcess();
-   getIfProc->start(QString("ifconfig"), QStringList() << ident);
+   getIfProc->start(IFCONFIG, QStringList() << ident);
    if (getIfProc->waitForFinished(2000)) {
      ifconfigOutput.clear();
      ifconfigOutput = getIfProc->readAllStandardOutput().simplified();
    }
 
-   //qDebug() << "ifconfig output: " << ifconfigOutput <<"\n";
+   //qDebug() << IFCONFIG + " output: " << ifconfigOutput <<"\n";
 
    getIfProc->kill();
    delete getIfProc;

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2011-03-31 22:14:18 UTC (rev 9858)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2011-03-31 22:18:31 UTC (rev 9859)
@@ -6,6 +6,7 @@
 #include <QMenu>
 
 #define PROGPATH QString("/usr/local/share/pcbsd/pc-netmanager")
+#define IFCONFIG QString("/sbin/ifconfig")
 
 class QString;
 class QPixmap;



More information about the Commits mailing list