[PC-BSD Commits] r9858 - pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager

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


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

Modified:
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/pcnetwork.desktop
Log:

Make network manager sudo-ready



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp	2011-03-31 22:09:28 UTC (rev 9857)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.cpp	2011-03-31 22:14:18 UTC (rev 9858)
@@ -157,7 +157,7 @@
                     if ( tmpfile.open() ) {
                     QTextStream streamout( &tmpfile );
                       streamout << "#!/bin/sh\n";
-                      streamout << "ifconfig " + tmp + " create wlandev " + dev + "\n";
+                      streamout << IFCONFIG + tmp + " create wlandev " + dev + "\n";
                       streamout << "echo 'wlans_" + dev + "=\"" + tmp + "\"' >>/etc/rc.conf\n";
                       tmpfile.close();
                     }
@@ -330,7 +330,7 @@
 
 QString NetworkMan::getIpForIdent( QString ident )
 {
-   QString cmd = "ifconfig lagg0 | grep " + ident;
+   QString cmd = IFCONFIG + " lagg0 | grep " + ident;
    QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
    if ( ! checkLagg.isEmpty() )
     ident = "lagg0";
@@ -389,7 +389,7 @@
      QString tmp;
        
      QProcess *getIfProc = new QProcess();
-     getIfProc->start(QString("ifconfig"), QStringList() << Devs[sel]);
+     getIfProc->start(IFCONFIG, QStringList() << Devs[sel]);
      if (getIfProc->waitForFinished(2000)) {
        tmp = getIfProc->readAllStandardOutput().simplified();
      }
@@ -562,7 +562,7 @@
 
 QString NetworkMan::getNetmaskForIdent( QString ident )
 {
-   QString cmd = "ifconfig lagg0 | grep " + ident;
+   QString cmd = IFCONFIG + " lagg0 | grep " + ident;
    QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
    if ( ! checkLagg.isEmpty() )
     ident = "lagg0";
@@ -689,7 +689,7 @@
         QFile fileout( PREFIX + "/share/pcbsd/xstartup/tray-" + Devs[sel] + ".sh");
         if ( fileout.open( QIODevice::WriteOnly ) ) {
           QTextStream streamout( &fileout );
-          streamout << "pc-nettray " + Devs[sel] + " &";
+          streamout << "sudo pc-nettray " + Devs[sel] + " &";
           fileout.close();
 	    
 	  runCommand("chmod 755 \"" + PREFIX + "/share/pcbsd/xstartup/tray-" + Devs[sel] + ".sh\"");
@@ -699,8 +699,7 @@
 	  ExeProc = new QProcess();
           QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
           ExeProc->setProcessEnvironment(env);
-          ExeProc->start(QString("su"), QStringList() << username <<  "-m -c" \
-			<< "pc-nettray " +  Devs[sel] );
+          ExeProc->start(QString("sudo"), QStringList() << "pc-nettray " +  Devs[sel] );
 		    
         }
 	
@@ -846,7 +845,7 @@
 {
         int currentItem = listNetDev->currentRow();
     if ( currentItem != -1 ) {
-	runCommand("ifconfig " + Devs[currentItem] + " down");
+	runCommand(IFCONFIG + " " + Devs[currentItem] + " down");
     }
 
 }
@@ -858,7 +857,7 @@
 {
         int currentItem = listNetDev->currentRow();
     if ( currentItem != -1 ) {
-	runCommand("ifconfig " + Devs[currentItem] + " up");		
+	runCommand(IFCONFIG + " " + Devs[currentItem] + " up");		
     }	
 }
 

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h	2011-03-31 22:09:28 UTC (rev 9857)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/networkman.h	2011-03-31 22:14:18 UTC (rev 9858)
@@ -1,6 +1,8 @@
 #ifndef NETMAN_H
 #define NETMAN_H
 
+#define IFCONFIG QString("/sbin/ifconfig")
+
 #include <qdialog.h>
 #include <QListWidgetItem>
 #include <QProcess>

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/pcnetwork.desktop
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/pcnetwork.desktop	2011-03-31 22:09:28 UTC (rev 9857)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkManager/pcnetwork.desktop	2011-03-31 22:14:18 UTC (rev 9858)
@@ -1,6 +1,6 @@
 [Desktop Entry]
 Encoding=UTF-8
-Exec=pc-netmanager
+Exec=sudo pc-netmanager
 Icon=network-wired
 Type=Application
 



More information about the Commits mailing list